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

Add a BSONInt64 type

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.0
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: