Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🌱 A new release!
5.5.0 (2023-09-12)
The MongoDB Node.js team is pleased to announce version 5.5.0 of the
bson
package!Release Notes
This release is focused on a bug fix and a new feature for our
Decimal128
class.Decimal128
constructor andDecimal128.fromString
now throw when detecting loss of precisionPrior to this release,
Decimal128
would round numbers with more than 34 significant digits and lose precision. Now, on detecting loss of precision,Decimal128
's constructor andDecimal128.fromString
will throw aBSONError
. This behaviour should have been the default as theDecimal128
class was always intended to be high-precision floating point value. As such, silently performing inexact rounding is undesirable behaviour.New
Decimal128.fromStringWithRounding
static methodWe understand that some of our users may have depended on the rounding behaviour of
Decimal128.fromString
for their applications. To support these users, we have exposed this behaviour via theDecimal128.fromStringWithRounding
method. Anywhere thatDecimal128.fromString
was used with the expectation that rounding would occur can be replaced with a call to this new method.We also want to express our gratitude to @hconn-riparian for reporting a related rounding bug and fix in #560 which has been included in our implementation of this feature.
Read more about inexact rounding and the rationale for this change in our
Decimal128
specification.Features
Bug Fixes
Documentation
We invite you to try the
bson
library immediately, and report any issues to the NODE project.