Skip to content

Instantly share code, notes, and snippets.

@evanchaney
Created April 21, 2013 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanchaney/59d5824e2917fc3ff0ca to your computer and use it in GitHub Desktop.
Save evanchaney/59d5824e2917fc3ff0ca to your computer and use it in GitHub Desktop.
Log: reproducing conflicting-mods issue in Mongoid using Mongo 2.0.4
Loading development environment (Rails 3.2.13)
2.0.0-p0 :001 > t = Train.create!
MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} (1.4248ms)
MOPED: 127.0.0.1:27017 INSERT database=mongoid_conflicting_mods_development collection=trains documents=[{"_id"=>"51745d86e3defe5857000001"}] flags=[]
COMMAND database=mongoid_conflicting_mods_development command={:getlasterror=>1, :safe=>true} (52.5570ms)
=> #<Train _id: 51745d86e3defe5857000001, >
2.0.0-p0 :002 > t.update_attributes(cars_attributes: [{capacity: 2}])
MOPED: 127.0.0.1:27017 UPDATE database=mongoid_conflicting_mods_development collection=trains selector={"_id"=>"51745d86e3defe5857000001"} update={"$set"=>{"seats"=>[{"_id"=>"51745d8be3defe5857000002"}, {"_id"=>"51745d8be3defe5857000003"}]}, "$pushAll"=>{""=>[{"_id"=>"51745d8be3defe5857000004", "seats"=>[{"_id"=>"51745d8be3defe5857000002"}, {"_id"=>"51745d8be3defe5857000003"}]}]}} flags=[]
COMMAND database=mongoid_conflicting_mods_development command={:getlasterror=>1, :safe=>true} (4.5981ms)
Moped::Errors::OperationFailure: The operation: #<Moped::Protocol::Command
@length=100
@request_id=5
@response_to=0
@op_code=2004
@flags=[]
@full_collection_name="mongoid_conflicting_mods_development.$cmd"
@skip=0
@limit=-1
@selector={:getlasterror=>1, :safe=>true}
@fields=nil>
failed with error 10151: "have conflicting mods in update"
See https://github.com/mongodb/mongo/blob/master/docs/errors.md
for details about this error.
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/node.rb:87:in `block in command'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/node.rb:582:in `[]'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/node.rb:582:in `block (3 levels) in flush'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/node.rb:581:in `map'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/node.rb:581:in `block (2 levels) in flush'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/node.rb:138:in `ensure_connected'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/node.rb:577:in `block in flush'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/node.rb:592:in `logging'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/node.rb:576:in `flush'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/node.rb:301:in `pipeline'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/session/context.rb:71:in `block in update'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/session/context.rb:109:in `block in with_node'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/cluster.rb:209:in `block in with_primary'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/node.rb:183:in `ensure_primary'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/cluster.rb:208:in `with_primary'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/moped-1.4.5/lib/moped/session/context.rb:108:in `with_node'
... 12 levels...
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:403:in `_run__2543480269492465978__save__3537247627712855762__callbacks'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/mongoid-3.1.3/lib/mongoid/callbacks.rb:130:in `run_callbacks'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/mongoid-3.1.3/lib/mongoid/persistence/modification.rb:24:in `prepare'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/mongoid-3.1.3/lib/mongoid/persistence/operations/update.rb:45:in `persist'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/mongoid-3.1.3/lib/mongoid/persistence.rb:145:in `update'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/mongoid-3.1.3/lib/mongoid/persistence.rb:82:in `save'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/mongoid-3.1.3/lib/mongoid/persistence.rb:181:in `update_attributes'
from (irb):2
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
from /Users/evan/.rvm/gems/ruby-2.0.0-p0@mongoid_conflicting_mods/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'2.0.0-p0 :003 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment