Add built-in DecimalEncoder and DecimalDecoder

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Unknown
    • 4.15.0
    • Affects Version/s: None
    • Component/s: None
    • 🔵 Done
    • Python Drivers
    • Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      Since we can't auto-convert Decimal128 to decimal.Decimal for reasons explained in PYTHON-5395, we should add correct implementations of the DecimalEncoder and DecimalDecoder codec classes we currently have in test_custom_types.py.

      Definition of done

      Provide publicly accessible and documented DecimalEncoder and DecimalDecoder codec classes. Our examples will need to be updated to reference these new classes.

      Pitfalls

      The Decimal128 specification requires us to warn users that converting from a BSON data type to a builtin data type could result in data loss.

              Assignee:
              Noah Stapp
              Reporter:
              Noah Stapp
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: