Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-574

Mongo::OperationFailure: Database command 'create' failed: unrecognized command: $query

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.8.5
    • Affects Version/s: 1.8.3
    • Component/s: None
    • Labels:
      None
    • Environment:
      MongoDB 2.0.4, Ruby driver 1.8.4, Mongoid 2.7.1

      I get the following error after upgrading to the 1.8.4 driver:

      irb(main):001:0> User.create! username: 'fred'
      MONGODB (7.5ms) banjo_staging['$cmd'].create({:create=>"users"}).limit(-1)
      Mongo::OperationFailure: Database command 'create' failed: unrecognized command: $query
      from /app/vendor/bundle/ruby/1.9.1/gems/mongo-1.8.4/lib/mongo/db.rb:530:in `rescue in command'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongo-1.8.4/lib/mongo/db.rb:521:in `command'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongo-1.8.4/lib/mongo/db.rb:296:in `create_collection'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/collections/master.rb:41:in `initialize'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/collection.rb:127:in `new'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/collection.rb:127:in `master'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/collection.rb:98:in `insert'
      from /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/method_tracer.rb:491:in `block in insert_with_trace_ActiveRecord_klass_insert'
      from /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/method_tracer.rb:240:in `trace_execution_scoped'
      from /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/method_tracer.rb:486:in `insert_with_trace_ActiveRecord_klass_insert'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/persistence/operations/insert.rb:27:in `block in persist'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/persistence/insertion.rb:26:in `block (3 levels) in prepare'
      from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:414:in `run1298955003981228075create1742471512845801379_callbacks'
      from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
      from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
      from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
      ... 7 levels...
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/persistence/insertion.rb:24:in `block in prepare'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/persistence/insertion.rb:22:in `tap'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/persistence/insertion.rb:22:in `prepare'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/persistence/operations/insert.rb:26:in `persist'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/persistence.rb:49:in `insert'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/persistence.rb:230:in `block (2 levels) in create!'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/persistence.rb:229:in `tap'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/persistence.rb:229:in `block in create!'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/threaded/lifecycle.rb:173:in `_creating'
      from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.7.1/lib/mongoid/persistence.rb:228:in `create!'
      from (irb):1
      from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
      from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
      from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
      from script/rails:11:in `require'

            Assignee:
            tyler@10gen.com Tyler Brock
            Reporter:
            fbjork Fredrik Björk
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: