Skip to content

v6.1.0

Compare
Choose a tag to compare
@W-A-James W-A-James released this 13 Sep 17:34
· 41 commits to main since this release
58c002d

6.1.0 (2023-09-12)

The MongoDB Node.js team is pleased to announce version 6.1.0 of the bson package!

Release Notes

Add new Decimal128.fromStringWithRounding static method

Following the merging of the Decimal128.fromString bug fix in #613, we understand that some users may have been relying on our inexact rounding behaviour in their applications. To address this need, we have exposed the inexact rounding behaviour via a new static method, Decimal128.fromStringWithRounding.

Thank you to @hconn-riparian for reporting a related rounding bug and fix in #560 which has been included in this feature.

// 5.x
> let d = Decimal128.fromString('127341286781293491234791234667890123')
new Decimal128("1.273412867812934912347912346678901E+35")

// 6.x
> let d = Decimal128.fromString('127341286781293491234791234667890123')
Uncaught:
BSONError: "127341286781293491234791234667890123" is not a valid Decimal128 string - inexact rounding
    at invalidErr (./js-bson/lib/bson.cjs:1402:11)
    at Decimal128.fromStringInternal (./js-bson/lib/bson.cjs:1633:25)
    at Decimal128.fromString (./js-bson/lib/bson.cjs:1424:27)

> d = Decimal128.fromStringWithRounding('127341286781293491234791234667890123')
new Decimal128("1.273412867812934912347912346678901E+35")

See our driver specifications for more information on inexact rounding.

Improved ObjectId serialization performance

Thanks to @billouboq for submitting the performance fix merged in #614. When using a for-loop instead of creating a new 12 byte view before calling Uint8Array.prototype.set, our internal testing shows a 25% increase in MB/s throughput of ObjectId serialization!

Features

Bug Fixes

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.