Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-22637

OP_INSERT can fail when inserted document contains no _id

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.2.1
    • Component/s: Write Ops
    • None
    • ALL
    • Hide

      Standalone 3.2.1 mongod server.

      I used a document that looks like this:

      new BsonDocument('b', new BsonBinary(new byte[262131]))
      

      I had to hack the Java driver to not automatically add an _id and to actually send an OP_INSERT to a 3.2 driver.

      Show
      Standalone 3.2.1 mongod server. I used a document that looks like this: new BsonDocument( 'b' , new BsonBinary( new byte [262131])) I had to hack the Java driver to not automatically add an _id and to actually send an OP_INSERT to a 3.2 driver.

      Calling getlasterror after inserting a 262144-byte document without an _id via OP_INSERT fails with code 1 and the following message:

      Collection::insertDocument got document without _id for ns:JavaDriverTest.com.mongodb.operation.InsertOperationSpecification
      

      A 262143-byte document succeeds, and so does a 3.0 server.

      I don't see this as particularly severe because most drivers will automatically add an _id field to all documents before insertion.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: