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

BSON::InvalidDocument: Document too large: This BSON documents is limited to 4194304 bytes.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.8.3
    • Affects Version/s: 1.8.0
    • Component/s: None
    • None
    • Environment:
      Ruby 1.9.3, Mongoid 2.5.1, Rails 3.2.11

      Running the following query against a Mongo 2.0.4 database:

      friend_ids = [BSON::ObjectId('4e951c1f722f7f000671c20a'), BSON::ObjectId('4e9ef9e3167d2e0001034a55')]

      User.db.collection('users').find({_id: {'$in' => friend_ids}}) do |cursor|
      cursor.each do |u|
      puts "#

      {u['_id']}

      "
      end
      end

      I get the following error:

      BSON::InvalidDocument: Document too large: This BSON documents is limited to 4194304 bytes.
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/bson-1.8.0/lib/bson/bson_c.rb:24:in `serialize'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/bson-1.8.0/lib/bson/bson_c.rb:24:in `serialize'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mongo-1.8.0/lib/mongo/cursor.rb:567:in `construct_query_message'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mongo-1.8.0/lib/mongo/cursor.rb:482:in `block in send_initial_query'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mongo-1.8.0/lib/mongo/util/logging.rb:33:in `block in instrument'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mongo-1.8.0/lib/mongo/util/logging.rb:65:in `instrument'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mongo-1.8.0/lib/mongo/util/logging.rb:32:in `instrument'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rpm_contrib-2.1.11/lib/rpm_contrib/instrumentation/mongo.rb:26:in `block in instrument_with_newrelic_trace'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.5.3.25/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rpm_contrib-2.1.11/lib/rpm_contrib/instrumentation/mongo.rb:24:in `instrument_with_newrelic_trace'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mongo-1.8.0/lib/mongo/cursor.rb:479:in `send_initial_query'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mongo-1.8.0/lib/mongo/cursor.rb:464:in `refresh'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mongo-1.8.0/lib/mongo/cursor.rb:128:in `next'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mongo-1.8.0/lib/mongo/cursor.rb:289:in `each'
      from (irb):9:in `block in irb_binding'
      from /Users/fredrik/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mongo-1.8.0/lib/mongo/collection.rb:274:in `find'

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

              Created:
              Updated:
              Resolved: