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

When creating collection with autoIndexId set to false, upserts create documents with no _id

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 2.4.3
    • None
    • Write Ops
    • None
    • Debian running 2.4.3
    • ALL

    Description

      Bar.py

       
      import pymongo
      conn = pymongo.Connection()
      coll = conn.test.create_collection('bar', autoIndexId=False)
      coll.update({'a': 1}, {'$set': {'b': 2}}, upsert=True)
      list(coll.find())
      [{u'a': 1, u'b': 2}] # NO _id!!

      Once _id is missing we saw fatal assertions coming from replica set code (we tried creating the index but it complain on dup key error) and failed migration because migrated documents must contain a _id. I assume all documents in mongo must have a _id.

      Attachments

        Issue Links

          Activity

            People

              scotthernandez Scott Hernandez
              alonho Alon Horev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: