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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.7
    • Affects Version/s: 2.6.3
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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 (Inactive)
            Reporter:
            Thomas Rueckstiess (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: