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

Add a BSONInt64 type

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: None
    • Security Level: Public
    • Labels:
      None

      Description

      In python 2.x PyMongo decodes BSON int64 to the python long type. Python 3 only has an int type so BSON int64 is decoded to int. This is a lossy conversion. There are several use cases for storing a low value integer as an int64 in MongoDB, but round tripping those value with python 3 loses information.

      PyMongo's bson module should include a BSONInt64 class (I'm open to other names). It should inherit from long in python 2 and int in python 3. The bson codec will always encode it to BSON int64, regardless of value.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              luke.lovett Luke Lovett
              Reporter:
              behackett Bernie Hackett
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: