Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-623

Python driver should not allow sending _ids with a key starting with $

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.7
    • Affects Version/s: 2.6.3
    • Component/s: None
    • None

      See related SERVER-12209.

      The Python driver checks other document keys and disallows prefixed $, but apparently not for _id.

      Any such _id gets inserted on the primary (despite --objcheck) but will crash all secondaries immediately after.

      The Python driver should reject sending such bad {{_id}}s, and additionally converting the obvious {$oid: "..."} form to a proper ObjectId type instead.

      This code run against a replica set primary crashes all secondaries:

      from pymongo import MongoClient
      
      mc = MongoClient()
      mc.test.docs.insert({'_id': {'$oid': "52d0b971b3ba219fdeb4170e"}})
      

            Assignee:
            kyle.erf Kyle Erf
            Reporter:
            thomas.rueckstiess@mongodb.com Thomas Rueckstiess
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: