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!
7.0.0 (2025-11-05)
The MongoDB Node.js team is pleased to announce version 7.0.0 of the
bsonpackage!Release Notes
⚠ Breaking Changes
Minimum supported Node.js version now 20.19.0
The minimum supported Node.js version is now v20.19.0. We strive to keep our minimum supported Node.js version in sync with the runtime's release cadence to keep up with the latest security updates and modern language features. Our TypeScript target has also been updated to ES2023.
BSON now requires BigInt literal support
BSON now uses Javascript BigInt syntax and requires a JS engine with support for BigInt literal syntax.
All BSON bundles now use
globalThis.cryptofor random byte generationUntil [email protected], BSON has supported Node.js v16. Node.js v16 does not include
cryptoin the global object, which necessitated importingcryptofromnode:crypto. This require has caused many headaches for bundlers. We improved the situation in NODE-6074, but this release updates our Node.js bundle to rely on the global object instead and removes all requires from the bundle.BSON no longer vendors
atob,btoa, andTextEncoderfor react native buildsThe React Native JS engine (Hermes) now supports
atob,btoa, andTextEncodernatively and polyfills are no longer needed. BSON no longer includes these polyfills for react native builds.ObjectId constructor no longer accepts a number
If you wish to create an ObjectId from a numeric timestamp, use
ObjectId.createFromTime()instead.BSON Binary subtype 2 constant deprecated
BSON Binary subtype 2 was previously deprecated in the BSON specification, but the corresponding subtype constant remained available in the BSON library. This constant has now been deprecated to align with the specification.
Non-breaking Features
New
bsonTypesymbol property as an alias for_bsontypeJS classes representing BSON values now have a
bsonTypesymbol property as an alias for the existing_bsontypeproperty. This makes it easier to distinguish between values of a specific BSON type and documents with arbitrary keys after deserializing:It is safe to replace all uses of
value._bsontypewithvalue[bsonType].All Changes
_bsontype(#829) (1e1b619)Documentation
We invite you to try the
bsonlibrary immediately, and report any issues to the NODE project.