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

json_util uses wrong format for binary type

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.4.1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Minor Change

      The official format for a Binary object is {{

      {"$binary": "<bindata>", "$type": "<t>"}

      }} (the type is a two-char hex string) [ref], but json_util uses {{

      {"$binary": "<bindata>", "$type": <t>}

      }} (the type is an integer) instead.

      I noticed this bug when trying to read the output of mongoexport from Python.

      I've attached a patch to fix this bug. The patch also updates the doctests in the json_util module.

      This change will break any code that has stored the broken JSON anywhere and then reads it back after updating.

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            gmacon George Macon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: