-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: bson-4.1.0
-
Component/s: BSON
What problem are you facing?
When using EJSON stringify (relaxed=false) double's are forced to be no longer than 13 digits. The change was introduced in v4.1.0 (NODE-2431, DRIVERS-792, SPEC-1537) to support compatibility with other drivers. The spec change was intended to make the tests more portable and not to make changes to library functionality. We should support the maximum precision that javascript can support.
What driver and relevant dependency versions are you using?
BSON v4.1.0 or later
Steps to reproduce?
EJSON.stringify({a: new Double(1639852160931802)}, { relaxed: false }) // {"a":{"$numberDouble":"1.6398521609318E+15"}}
Note, the output value is forced to exponential notation that ends in "318" which will cut off the "02" from the original number when restored to a javascript value.
- related to
-
NODE-2431 Reduce floating point precision required of extended json implementations
- Closed
-
DRIVERS-792 Reduce floating point precision required of extended json implementations
- Implementing