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

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.6.3
    • 2.7
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: