Skip to content

1.1.6

Compare
Choose a tag to compare
@nbbeeken nbbeeken released this 16 Mar 14:43
6fc7a87

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!