Releases: mongodb/js-bson
4.2.3
The MongoDB Node.js team is pleased to announce version 4.2.3 of the bson module!
With this version, inspecting BSON objects produces the exact code to instantiate them.
Bug Fixes
- [NODE-2947] - Inspection method for Binary does not yield same result when evaluated
- [NODE-3064] - Fix BSON type classes being called without new
- [NODE-3069] - Cannot use bson package in a webworker.
Documentation
- API: https://github.com/mongodb/js-bson#readme
- Changelog: https://github.com/mongodb/js-bson/blob/master/HISTORY.md#change-log
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!
v4.2.2
The MongoDB Node.js team is pleased to announce version 4.2.2 of the bson module!
This patch fixes a critical bug in the 4.2.1 release we recommend all users of 4.2.1 upgrade to this version immediately. There was an unintended dependency published on tslib
without tslib
being specified in our package.json.
This patch includes additional 'inspect' methods on each BSON type class that makes printing out values consistent and readable.
Bug
- remove tslib usage and fix Long method alias
- NODE-2846 - Missing function overload type for
EJSON.stringify
- NODE-2847 - bson does not expose a default export
- NODE-2848 - bson@4.2.0 breaks serialization with bson@1.x
Task
- NODE-2844 - Add downlevel-dts to our BSON type definitions pipeline
- NODE-2875 - Add correct inspect methods for BSON Types
- NODE-2845 - Make Long class alias methods into methods rather than properties
Documentation
- API: https://github.com/mongodb/js-bson#readme
- Changelog: https://github.com/mongodb/js-bson/blob/master/HISTORY.md#change-log
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!
v4.2.1
Deprecated
This version has a critical bug that prevents it from importing correctly. There was an unintended dependcy on tslib published without tslib being specified in our package.json. A workaround is installing tslib manually but we highly recommend users of this version should update to v4.2.2 instead.
The MongoDB Node.js team is pleased to announce version 4.2.1 of the bson module!
This patch includes additional 'inspect' methods on each BSON type class that makes printing out values consistent and readable.
Bug
- NODE-2846 - Missing function overload type for
EJSON.stringify
- NODE-2847 - bson does not expose a default export
- NODE-2848 - bson@4.2.0 breaks serialization with bson@1.x
Task
- NODE-2844 - Add downlevel-dts to our BSON type definitions pipeline
- NODE-2875 - Add correct inspect methods for BSON Types
- NODE-2845 - Make Long class alias methods into methods rather than properties
Documentation
- API: https://github.com/mongodb/js-bson#readme
- Changelog: https://github.com/mongodb/js-bson/blob/master/HISTORY.md#change-log
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!
v4.2.0
The MongoDB Node.js team is pleased to announce version 4.2.0 of the bson
module!
Release Highlights
Convert code base to Typescript
Before this release we have converted the codebase to Typescript and you can find our bundled type definitions in the release.
Converting to Typescript gave us an opportunity to fine tune our build pipeline, you should expect proper web bundle support with sourcemaps.
If you were to ever encounter an issue or just want to get insight into the inner workings of the BSON library these sourcemaps will allow you to debug the original source code that is in typescript.
If you’re curious about Typescript take a look here.
A primary reason for converting to typescript is the first in class developer experience the language offers.
It enables us to communicate APIs more succinctly to you the user and for you the user to benefit from excellent autocompletion and code intellisence while working with the BSON library.
BigInt support
BigInt is a new primitive type added to the ECMAScript specification, with this release you can use these new Long helpers to serialize BigInt(s) to BSON.
class Long {
// ...
/**
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
* @param value - The number in question
* @param unsigned - Whether unsigned or not, defaults to signed
* @returns The corresponding Long value
*/
static fromBigInt(value: bigint, unsigned?: boolean): Long;
/** Converts the Long to a BigInt (arbitrary precision). */
toBigInt(): bigint;
// ...
}
It is important to note that BigInt supports arbitrary precision values while Long’s are clamped to maximum and minimum 64-bit integer values.
We do have an investigation into supporting BigInt directly as well as helpers for Decimal128 interop but for now this is a great stepping stone to get started using BigInt in your code today!
FNV1A Hashing Removed
A previous iteration of the ObjectId class utilized a Fowler–Noll–Vo hash function to generate a portion of the Id created on the client side.
This had been unused for sometime and here we were able to remove this code improving bundle sizes but without any breaking changes.
Documentation
- API: https://github.com/mongodb/js-bson#readme
- Changelog: https://github.com/mongodb/js-bson/blob/master/HISTORY.md#change-log
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!
Release Notes
Epic
- [NODE-2647] - Typescript BSON
Bug
- [NODE-2240] - Following the "Browser (no bundling)" in the README leads to missing "global"
- [NODE-2712] - Incorrect imports in ESM bundle
- [NODE-2769] - Long integers serialize as doubles
- [NODE-2770] - Fix crc32 function caching
Improvement
v4.0.4
The MongoDB Node.js team is pleased to announce version 4.0.4 of the bson
module!
This patch release fixes a regression introduced in v2 of the module, preventing round tripping of the deprecated BSON symbol
type. We don't expect any users are actually using this value, but it is something used in internal testing of the driver and as such was deemed high priority to fix.
Release Notes
Bug
- [NODE-2518] - BSON loses type information when automatically upgrading symbols to strings
v1.1.4
The MongoDB Node.js team is pleased to announce version 1.1.4 of the bson
module!
This patch release resolves an issue with BSON serialization with invalid _bsontype
, originally reported by @xiaofen9. MongoDB will be issuing a CVE for this vulnerability, and we recommend that all users pin their version of the bson
module to 1.1.4 or higher.
Release Notes
Bug
- [NODE-2514] - BSON serialization ignores unknown _bsontype