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!
6.10.4 (2025-05-05)
The MongoDB Node.js team is pleased to announce version 6.10.4 of the
bson
package!Release Notes
Top-Level Await removed from the browser BSON bundle
In versions <6.10.4, BSON uses a top-level await to asynchronously import the
crypto
module. This change unintentionally caused headaches for users of webpack, react native, vite and other tools bundlers and tools.The top-level await has been removed from all BSON bundles. Thanks to @lourd for this contribution.
Prevent the creation of incorrectly sized float32 vectors
This adds validation to our
BSON.serialize
andEJSON.stringify
methods that will prevent creating float 32 vectors that are not a multiple of 4. Previously created vectors that do not meet this validation will still bedeserialized
andparsed
so they can be fixed.Additionally, the
toFloat32Array()
,toInt8Array()
, andtoPackedBits()
methods now perform the same validation that serialize does to prevent use of incorrectly formatted Binary vector values. (For example, a packed bits vector with more than 7 bits of padding)Vectors of an incorrect length could only be made manually (directly constructing the bytes and calling
new Binary
). We recommend usingtoFloat32Array
andfromFloat32Array
when interacting with Vectors in MongoDB as they handle the proper creation and translation of this data type.Bug Fixes
Documentation
We invite you to try the
bson
library immediately, and report any issues to the NODE project.