huacnlee/mongoid_auto_increment_id — Issue #6: Error in save
Author: nabaumana
Created: 2012-02-19 00:00:01+00:00
State: open

When I'm trying to save variable, it says me:
1.9.3p0 :006 > sub.save
Mongo::OperationFailure: Database command 'findandmodify' failed: (errmsg: 'No matching object found'; ok: '0.0').
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongo-1.5.2/lib/mongo/db.rb:520:in `command'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongo-1.5.2/lib/mongo/collection.rb:572:in `find_and_modify'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid_auto_increment_id-0.4.0/lib/mongoid_auto_increment_id.rb:10:in `generate_id'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid_auto_increment_id-0.4.0/lib/mongoid_auto_increment_id.rb:34:in `as_document'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/persistence/operations/insert.rb:27:in `block in persist'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/persistence/insertion.rb:26:in `block (3 levels) in prepare'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:403:in `_run__249101010__create__66955071__callbacks'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405:in `__run_callback'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/callbacks.rb:43:in `block in run_callbacks'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/callbacks.rb:68:in `call'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/callbacks.rb:68:in `run_cascading_callbacks'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/callbacks.rb:42:in `run_callbacks'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/persistence/insertion.rb:25:in `block (2 levels) in prepare'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:403:in `_run__249101010__save__66955071__callbacks'
... 3 levels...
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/callbacks.rb:43:in `block in run_callbacks'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/callbacks.rb:68:in `call'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/callbacks.rb:68:in `run_cascading_callbacks'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/callbacks.rb:42:in `run_callbacks'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/persistence/insertion.rb:24:in `block in prepare'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/persistence/insertion.rb:22:in `tap'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/persistence/insertion.rb:22:in `prepare'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/persistence/operations/insert.rb:26:in `persist'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/persistence.rb:49:in `insert'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.4.3/lib/mongoid/persistence.rb:154:in `upsert'
from (irb):6
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/console.rb:47:in `start'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/console.rb:8:in `start'
from /home/arkadey/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:41:in `'
from script/rails:6:in `require'