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

Add a BSONInt64 type

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0
    • Affects Version/s: None
    • Component/s: None
    • None

      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.

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

              Created:
              Updated:
              Resolved: