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

OP_INSERT can fail when inserted document contains no _id

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: 3.2.1
    • Fix Version/s: None
    • Component/s: Write Ops
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      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.

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: