-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
I'm completely and utterly confused by this one. It claims to have saved and persisted the document, but the document can't be found in the database. Mongo shell confirms that the document doesn't exist. Any idea what could cause this?
MongoDB v2.0.6, Mongoid v2.4.12, Rails v3.2.6
1.9.1 :014 > c = Cover.create!(title: "Some cover", state: "new", category: Category.first.id) => #<Cover _id: 500dfc56c4d3be50c5000003, _type: nil, created_at: 2012-07-24 01:37:27 UTC, updated_at: 2012-07-24 01:37:26 UTC, image: nil, title: "Some cover", download_count: 0, old_id: nil, tags: ["abstract"], state: "new", category: "abstract", location: "2012/07/23/0c69a210b75e012f3da20025902480d2/", slug: "some-cover", user_id: nil, approved_by_id: nil> 1.9.1 :015 > c.save! => true 1.9.1 :016 > c.errors.full_messages => [] 1.9.1 :017 > c.valid? => true 1.9.1 :018 > c.persisted? => true 1.9.1 :019 > Cover.find(c.id) Mongoid::Errors::DocumentNotFound: Document not found for class Cover with id(s) 500dfc56c4d3be50c5000003. from /home/rails/webapps/app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.4.12/lib/mongoid/criterion/inclusion.rb:151:in `block in execute_or_raise' from /home/rails/webapps/app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.4.12/lib/mongoid/criterion/inclusion.rb:149:in `tap' from /home/rails/webapps/app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.4.12/lib/mongoid/criterion/inclusion.rb:149:in `execute_or_raise' from /home/rails/webapps/app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.4.12/lib/mongoid/criterion/inclusion.rb:129:in `find' from /home/rails/webapps/app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.4.12/lib/mongoid/finders.rb:84:in `find' from (irb):19 from /home/rails/webapps/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start' from /home/rails/webapps/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start' from /home/rails/webapps/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>'