-
Type:
New Feature
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Python Drivers
-
None
-
None
-
None
-
None
-
None
-
None
We currently reject Python decimal instances and require the user to manually convert to Decimal128. We should investigate why we have this approach and consider encoding Python decimal instances by default.
>>> bson.encode({"d": decimal.Decimal('1.0')}) Traceback (most recent call last): File "<python-input-7>", line 1, in <module> encode({"d": decimal.Decimal('1.0')}) ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/shane/git/mongo-python-driver/bson/__init__.py", line 1053, in encode return _dict_to_bson(document, check_keys, codec_options) bson.errors.InvalidDocument: Invalid document {'d': Decimal('1.0')} | cannot encode object: Decimal('1.0'), of type: <class 'decimal.Decimal'>
Related to INTPYTHON-497.
- related to
-
INTPYTHON-497 Extend rather than replace TypeRegistry in write function
-
- Blocked
-