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

Strange behavior of ObjectId and 12 car string

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.10, 2.0.1
    • Component/s: None

      I just found a strange behaviour with ObjectId and 12 car strings. The documentation about ObjectId says it take a valid ObjectId (12 byte binary or 24 character hex string) but ObjectId also accept 12 car string which is not a byte binary representation. As example:

      >>> ObjectId('9'*12)
      ObjectId('393939393939393939393939')

      I expect an error as '9'*12 is not a valid byte binary representation.

      I don't think it's a desirable behaviour, maybe it's juste the doc which need a little update but it's not clear.

      If someone could tell me if it's a bug or a documentation outdated, thanks.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            lothiraldan FELD Boris
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: