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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.6.3
    • Fix Version/s: 2.7
    • Component/s: None
    • Labels:
      None

      Description

      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"}})

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kyle.erf Kyle Erf
              Reporter:
              thomasr Thomas Rueckstiess
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: