-
Type: Sub-task
-
Resolution: Fixed
-
Priority: Critical - P2
-
Affects Version/s: None
-
Component/s: BSON
Use Case
As a... driver engineer
I want... Decimal128 rounding to be correct
So that... users do not corrupt their data
User Impact
- Users storing values on the edges of the representable range of Decimal128 will have correctly rounded numbers when opting into using fromStringRounded
- Users whose applications were silently losing precision will now see an uncaught exception.
Dependencies
Possible shell impacts?
Unknowns
- How does this impact shell?
- Shouldn't have any shell impact since they already gracefully catch bson errors
- Do we want a global static option to control rounding?
- No
- Does this need a DOCSP ticket?
- Yes
Acceptance Criteria
Implementation Requirements
- update fromString to throw on inexact rounding
- in the rounding section of the code, if there are less significant digits encoded than exist in total, then we check for the digit to be rounded. If it is not zero then we should throw
Testing Requirements
- Unskip parse error spec tests and ensure that they are passing.
- Pull in new Decimal128 spec tests from
DRIVERS-2651
Documentation Requirements
- Release notes
Follow Up Requirements
- File ticket to add fromStringRounded static method
- File ticket to absorb change into 5.x driver
- File ticket to absorb change into 6.x driver
- backported by
-
NODE-5586 [5.x] Fix Decimal128 rounding issue
- Closed
- is depended on by
-
NODE-5561 (Next) Pull Decimal128 fix into driver
- Closed
-
NODE-5564 (5.x) Pull Decimal128 fix into driver
- Closed
-
COMPASS-7145 Investigate changes in NODE-5546: Fix Decimal128 rounding issue
- Closed