npm bson 1.1.6

latest releases: 6.9.0, 6.8.0, 6.7.0...
3 years ago

The MongoDB Node.js team is pleased to announce version 1.1.6 of the bson module!

The BSON library was written prior to the invention of the BigInt type in Javascript ecosystem.
As a result the library was not able to serialize the type properly and silently failed to correctly maintain the bigint value.
With this update, the library will now throw an error if it detects a bigint value.
However, we've also added to/fromBigInt helper methods to the long class, please note that numbers will be clamped to int64 bit width.

const bytes = BSON.serialize({ myBigNumber: Long.fromBigInt(23n) })
const doc = BSON.deserialize(bytes)
doc.myBigNumber.toBigInt() === 23n // true

New Feature

  • [NODE-2378] - Return error when failing to serialize bigint type and add Long class helpers

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.
Thanks very much to all the community members who contributed to this release!

Don't miss a new bson release

NewReleases is sending notifications on new releases.