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

The _id field is no longer automatically generated by mongos when missing

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.1, 2.7.0
    • Affects Version/s: 2.6.0
    • Component/s: Sharding
    • None
    • ALL

      Issue Status as of April 15, 2014

      ISSUE SUMMARY
      If the server receives a document for insert that is missing the _id field, it should generate one. A bug in 2.6 caused mongos not to create these _id values. This can violate the assumption that all documents have an _id and can lead to errors when inserting into a collection sharded on _id.

      USER IMPACT
      Minor, as all drivers automatically generate the _id. Some drivers (for example the Python driver) have an option to disable generating the _id field client-side. Using this option can cause issues when inserting documents to a sharded collection on _id through a mongos.

      WORKAROUNDS
      Use the driver default to auto-generate _id values.

      RESOLUTION
      This patch will cause mongos to auto-generate _id values if they are not present.

      AFFECTED VERSIONS
      Version 2.6.0 is affected by this bug.

      PATCHES
      The patch is included in the 2.6.1 production release.

      Original description

      In 2.4 if document to be inserted was missing _id when it got to mongos it seems that mongos would generate the _id.

      In 2.6 this does not happen. This breaks in situations where inserted document is going into collection sharded by _id or _id:"hashed".

            Assignee:
            greg_10gen Greg Studer
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:
              Resolved: