Skip to content

chore: update dependency bson to v6 #780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented May 24, 2025

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
bson ^1.1.6 -> ^6.10.4 age adoption passing confidence

Release Notes

mongodb/js-bson (bson)

v6.10.4

Compare Source

Bug Fixes
  • NODE-6074: Removes top-level await in bson with separate node and browser ESM bundles (#​749) (4602973)
  • NODE-6735, NODE-6711: add BSON vector validation to EJSON stringification, serialization and conversion to native types (#​748) (64ff6a2)

v6.10.3

Compare Source

Bug Fixes

v6.10.2

Compare Source

Bug Fixes
  • NODE-6608: calculateObjectSize returns the wrong value for bigint (#​742) (1fed073)

v6.10.1

Compare Source

Bug Fixes
  • NODE-6552: remove cache and use toStringTag in type helpers (#​740) (3ede13e)
Performance Improvements

v6.10.0

Compare Source

Features
Bug Fixes
  • NODE-6536: Binary.read never returns number[] and reads beyond content (#​727) (f99fdfd)

v6.9.1

Compare Source

The MongoDB Node.js team is pleased to announce version 6.9.1 of the bson package!

Release Notes

⚠️ Fixed potential data corruption bug when useBigInt64 is enabled

After refactoring to improve deserialization performance in #​649, we inadvertently introduced a bug that manifested when deserializing Long values with the useBigInt64 flag enabled. The bug would lead to negative Long values being deserialized as unsigned integers. This issue has been resolved here.

Thanks to @​rkistner for reporting this bug!

Bug Fixes

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.

v6.9.0

Compare Source

Features
Performance Improvements
  • NODE-6344: improve ObjectId.isValid(string) performance (#​708) (064ba91)
  • NODE-6356: Improve serialization performance (#​709) (61537f5)

v6.8.1

Compare Source

The MongoDB Node.js team is pleased to announce version 6.8.1 of the bson package!

Release Notes

⚠️ Fixed potential data corruption bug when useBigInt64 is enabled

After refactoring to improve deserialization performance in #​649, we inadvertently introduced a bug that manifested when deserializing Long values with the useBigInt64 flag enabled. The bug would lead to negative Long values being deserialized as unsigned integers. This issue has been resolved here.

Bug Fixes

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.

v6.8.0

Compare Source

Features
Performance Improvements

v6.7.1

Compare Source

The MongoDB Node.js team is pleased to announce version 6.7.1 of the bson package!

Release Notes

⚠️ Fixed potential data corruption bug when useBigInt64 is enabled

After refactoring to improve deserialization performance in #​649, we inadvertently introduced a bug that manifested when deserializing Long values with the useBigInt64 flag enabled. The bug would lead to negative Long values being deserialized as unsigned integers. This issue has been resolved here.

Bug Fixes

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.

v6.7.0

Compare Source

Features
Bug Fixes
  • NODE-6102: Double.fromString prohibiting '+' character and prohibiting exponential notation (#​674) (c58d1e2)
  • NODE-6123: utf8 validation is insufficiently strict (#​676) (ae8bac7)
  • NODE-6144: Long.fromString incorrectly coerces valid inputs to Long.ZERO in special cases (#​677) (208f7e8)

v6.6.1

Compare Source

The MongoDB Node.js team is pleased to announce version 6.6.1 of the bson package!

Release Notes

⚠️ Fixed potential data corruption bug when useBigInt64 is enabled

After refactoring to improve deserialization performance in #​649, we inadvertently introduced a bug that manifested when deserializing Long values with the useBigInt64 flag enabled. The bug would lead to negative Long values being deserialized as unsigned integers. This issue has been resolved here.

Bug Fixes

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.

v6.6.0

Compare Source

Features
  • NODE-5958: add BSON iterating API (#​656) (269df91)
  • NODE-5959: make byte parsing utils available on onDemand library (#​662) (efab49a)
Bug Fixes

v6.5.1

Compare Source

The MongoDB Node.js team is pleased to announce version 6.5.1 of the bson package!

Release Notes

⚠️ Fixed potential data corruption bug when useBigInt64 is enabled

After refactoring to improve deserialization performance in #​649, we inadvertently introduced a bug that manifested when deserializing Long values with the useBigInt64 flag enabled. The bug would lead to negative Long values being deserialized as unsigned integers. This issue has been resolved here.

Thanks to @​rkistner for reporting this bug!

Bug Fixes

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.

v6.5.0

Compare Source

Features
Bug Fixes
  • NODE-6016: flip byte order depending on system endianness (#​659) (6a7ef5d)

v6.4.1

Compare Source

The MongoDB Node.js team is pleased to announce version 6.4.1 of the bson package!

Release Notes

⚠️ Fixed potential data corruption bug when useBigInt64 is enabled

After refactoring to improve deserialization performance in #​649, we inadvertently introduced a bug that manifested when deserializing Long values with the useBigInt64 flag enabled. The bug would lead to negative Long values being deserialized as unsigned integers. This issue has been resolved here.

Fixed float byte-wise handling on big-endian systems

[!CAUTION]
Among the platforms BSON and the MongoDB driver support this issue impacts s390x big-endian systems. x86, ARM, and other little-endian systems are not affected. Existing versions of the driver can be upgraded to this release.

A change in BSON@6.4.0 (2024-02-29) started parsing and serializing floats using a Float64Array. When reading the bytes from this array the ordering is dependent on the platform it is running on and we now properly account for that ordering.

Bug Fixes
  • NODE-6812: incorrect negative bigint handling (#​762) (ce3e544)
  • NODE-6818: flip byte order depending on system endianness (#​766) (8a55718)

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.

v6.4.0

Compare Source

Features
Bug Fixes
  • NODE-5873: objectId symbol property not defined on instances from cross cjs and mjs (#​643) (4d9884d)
Performance Improvements
  • NODE-5557: move DataView and Set allocation used for double parsing and utf8 validation to nested path (#​611) (9a150e1)
  • NODE-5910: optimize small byte copies (#​651) (24d035e)
  • NODE-5934: replace DataView uses with bit math (#​649) (6d343ab)
  • NODE-5955: use pooled memory when possible (#​653) (78c4264)

v6.3.0

Compare Source

Features
  • NODE-3034: deprecate number as an input to ObjectId constructor (#​640) (44bec19)
  • NODE-5861: optimize parsing basic latin strings (#​642) (cdb779b)

v6.2.0

Compare Source

Features
Bug Fixes
  • NODE-5640: BsonVersionError improve message clarity (#​629) (eb98b8c)

v6.1.0

Compare Source

Features
  • NODE-5594: add Decimal128.fromStringWithRounding() static method (#​617) (6fee2d5)
Bug Fixes
  • NODE-5577: improve ObjectId serialization by around 10% (#​614) (81c8fa1)

v6.0.0

Compare Source

⚠ BREAKING CHANGES
  • NODE-5504: bump bson major version (#​605)
  • NODE-4770: remove 12 length string support from ObjectId constructor (#​601)
  • NODE-4769: remove ISO-8859-1 string support from Binary (#​602)
  • NODE-5223: remove deprecated cacheHexString (#​595)
  • NODE-4787: bump minimum Node.js version to v16.20.1 (#​590)
Features
  • NODE-4769: remove ISO-8859-1 string support from Binary (#​602) (74f7f8a)
  • NODE-4770: remove 12 length string support from ObjectId constructor (#​601) (409c592)
  • NODE-4787: bump minimum Node.js version to v16.20.1 (#​590) (1dcca92)
  • NODE-5223: remove deprecated cacheHexString (#​595) (76eca2b)
  • NODE-5504: bump bson major version (#​605) (9615902)
Bug Fixes
  • NODE-5509: Allow undefined or null params in ObjectId.equals (#​607) (e2674c6)
  • NODE-5546: decimal 128 fromString performs inexact rounding (#​613) (1384cee)
  • NODE-5559: account for quotes when inspecting Code and BSONSymbol (#​612) (0664840)

v5.5.1

Compare Source

The MongoDB Node.js team is pleased to announce version 5.5.1 of the bson package!

Release Notes

Clarify BSONVersionError message

Previously, our thrown BSONVersionError stated that the "bson type must be from 6.0 or later". Our intention is to prevent cross-major BSON types from reaching the serialization logic as breaking changes to the types could lead to silent incompatibilities in the serialization process. We've updated the message to make that intention clear: "bson types must be from bson 6.x.x".

Bug Fixes
  • NODE-5641: BsonVersionError improve message clarity (#​630) (d1ca218)

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.

v5.5.0

Compare Source

The MongoDB Node.js team is pleased to announce version 5.5.0 of the bson package!

Release Notes

This release is focused on a bug fix and a new feature for our Decimal128 class.

Decimal128 constructor and Decimal128.fromString now throw when detecting loss of precision

Prior to this release, Decimal128 would round numbers with more than 34 significant digits and lose precision. Now, on detecting loss of precision, Decimal128's constructor and Decimal128.fromString will throw a BSONError. This behaviour should have been the default as the Decimal128 class was always intended to be high-precision floating point value. As such, silently performing inexact rounding is undesirable behaviour.

New Decimal128.fromStringWithRounding static method

We understand that some of our users may have depended on the rounding behaviour of Decimal128.fromString for their applications. To support these users, we have exposed this behaviour via the Decimal128.fromStringWithRounding method. Anywhere that Decimal128.fromString was used with the expectation that rounding would occur can be replaced with a call to this new method.

We also want to express our gratitude to @​hconn-riparian for reporting a related rounding bug and fix in #​560 which has been included in our implementation of this feature.

// pre v5.5
> let d = Decimal128.fromString('127341286781293491234791234667890123')
new Decimal128("1.273412867812934912347912346678901E+35")

// >= v5.5
> let d = Decimal128.fromString('127341286781293491234791234667890123')
Uncaught:
BSONError: "127341286781293491234791234667890123" is not a valid Decimal128 string - inexact rounding
    at invalidErr (./js-bson/lib/bson.cjs:1402:11)
    at Decimal128.fromStringInternal (./js-bson/lib/bson.cjs:1633:25)
    at Decimal128.fromString (./js-bson/lib/bson.cjs:1424:27)

> d = Decimal128.fromStringWithRounding('127341286781293491234791234667890123')
new Decimal128("1.273412867812934912347912346678901E+35")

Read more about inexact rounding and the rationale for this change in our Decimal128 specification.

Features
  • NODE-5579: add Decimal128.fromStringWithRounding() static method (#​621) (70ca4fc)
Bug Fixes
  • NODE-5586: Decimal128 fromString performs inexact rounding (#​620) (63fb316)

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.

v5.4.0

Compare Source

Features
  • NODE-4938: improve react native bundle experience (#​578) (7e16636)
Bug Fixes
  • NODE-5363: defer byte slicing to utf8 decoding API in nodejs (#​585) (e087042)

v5.3.0

Compare Source

Features
  • NODE-5224: deprecate UUID hex string cache control (#​573) (70aea75)
Bug Fixes

v5.2.0

Compare Source

Features
  • NODE-4855: add hex and base64 ctor methods to Binary and ObjectId (#​569) (0d49a63)

v5.1.0

Compare Source

Features
5.0.1 (2023-02-16)
Bug Fixes
  • NODE-5025: no type definitions for es module (#​563) (50e90fc)
  • NODE-5048: webpack unable to bundle import with leading 'node:' (#​564) (3aed24a)
  • NODE-5056: EJSON.parse date handling when useBigInt64=true (#​562) (d5088af)

v5.0.1

Compare Source

v5.0.0

Compare Source

v4.7.2

Compare Source

The MongoDB Node.js team is pleased to announce version v4.7.2 of the bson package!

Bug Fixes
  • NODE-4932: remove .0 suffix from double extended json values (#​553) (a298d22)

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.

v4.7.1

Compare Source

The MongoDB Node.js team is pleased to announce version v4.7.1 of the bson package!

Bug Fixes
  • NODE-4905: double precision accuracy in canonical EJSON (#​549) (d86bd52)

Documentation

We invite you to try the bson library immediately, and report any issues to the NODE project.

v4.7.0

Compare Source

Features
4.6.5 (2022-07-07)
Bug Fixes
  • NODE-3630: remove float parser and test edge cases for Double (#​502) (54ca603)
  • NODE-4211: Do not require crypto in browser builds (#​500) (b32ab40)
  • NODE-4302: remove downlevel ts and typesVersions (#​501) (651b60e)
  • NODE-4381: handle __proto__ well in EJSON (#​506) (4bda57d)
4.6.4 (2022-05-19)
4.6.3 (2022-04-20)
4.6.2 (2022-03-22)
Bug Fixes
  • MONGOSH-1155: update error message in ObjectId class (#​493) (67fbc7c)
  • NODE-3015: ObjectId.equals should use Buffer.equals for better performance (#​478) (8305bdf)
  • NODE-3962: correct type for ObjectiId._bsontype (#​480) (9671773)
4.6.1 (2022-01-06)
Bug Fixes
  • NODE-3760: ObjectId.isValid string and byte length match (#​475) (187d1c4)
  • NODE-3815: update Decimal128 constructor validation (#​476) (95e8293)
  • NODE-3821: nullish check before using toBSON override function (#​477) (1d898b6)

v4.6.5

Compare Source

v4.6.4

Compare Source

v4.6.3

Compare Source

v4.6.2

Compare Source

v4.6.1

Compare Source

v4.6.0

Compare Source

Features
  • NODE-3740: Implement root and top level key utf-8 validation settings for BSON (#​472) (07019a0)
Bug Fixes
  • NODE-3724: Fix BSONTypeError and BSONError to correctly handle instanceof checks (#​471) (d8f334b)
4.5.4 (2021-11-03)
Bug Fixes
  • NODE-3640: Fix Int32 constructor to coerce its argument to int32 (#​466) (d388f1e)
  • NODE-3662: error checking to make sure that ObjectId results in object with correct properties (#​467) (5f99b1b)
4.5.3 (2021-10-05)
Bug Fixes
  • NODE-3493: code and symbol tests are partially testing the wrong types (#​459) (80d7f03)
  • NODE-3534: add subtype 0x6 and 0x7 constants on Binary class (#​461) (52cfe9c)
  • NODE-3629: correct corpus runner and add null checks (#​464) (d75102d)
4.5.2 (2021-09-14)
Bug Fixes
  • NODE-3021: fix a long standing bug in Decimal128.fromString() (#​458) (824939a)
  • NODE-3582: fix internal marked APIs, add toString methods to Int32 and Double (#​457) (b46ab5f)
4.5.1 (2021-08-24)
Bug Fixes

v4.5.4

Compare Source

v4.5.3

Compare Source

v4.5.2

Compare Source

v4.5.1

Compare Source

v4.5.0

Compare Source

Features
  • NODE-3504: add unambiguous Timestamp() constructor overload (#​449) (0298dd8)
Bug Fixes
4.4.1 (2021-07-06)
Bug Fixes

v4.4.1

Compare Source

v4.4.0

Compare Source

Features
  • NODE-3264: allow Decimal128(string), Long(string), Long(bigint) (#​437) (392c1bc)
  • make circular input errors for EJSON expressive (#​433) (7b351cc)
Bug Fixes
  • make Long inspect result evaluable (3a2eff1)
  • NODE-3153: correctly deserialize __proto__ properties (#​431) (f34cabc)
  • accept Uint8Array where Buffer is accepted (#​432) (4613763)
  • clean up instanceof usage (9b6d52a)
  • improve ArrayBuffer brand check in ensureBuffer (#​429) (99722f6)

v4.3.0

Compare Source

Features
4.2.3 (2021-03-02)
Bug Fixes
4.2.2 (2020-12-01)
Bug Fixes
4.2.1 (2020-12-01)
Bug Fixes

v4.2.3

Compare Source

v4.2.2

Compare Source

v4.2.1

Compare Source

v4.2.0

Compare Source

Features
Bug Fixes
  • adds interfaces for EJSON objects (7f5f1a3)
  • Correct API Extractor config to omit definition file from dist (#​407) (ace8647)
  • coverage (992e2e0)
  • deprecate cacheFunctionsCrc32 (ea83bf5)
  • Rework rollup config to output named and default exports (#​404) (a48676b)
  • Throw on BigInt type values (#​397) (2dd54e5)
  • type issues with SerializeOptions and Long methods accepting Timestamp (c18ba71)

v4.1.0

Compare Source

Bug Fixes
  • spelling in deserializer errors (4c6f2e4)
  • object-id: harden the duck-typing (4b800ae)
  • parse value of Int32 in constructor (5cda40f)
  • Reduce floating point precision required of extended json implementations (#​369) (5e35d1a)
Features
  • add support for primitives to EJSON.stringify (329857d)

4.0.4 (2020-03-26)

Bug Fixes
  • improve EJSON generation for previously skipped edge cases (30f5a8f)
  • only upgrade symbol to string if promoteValues is true (067a7ba)

4.0.3 (2020-01-09)

Bug Fixes
  • support Number object in Int32 and Double constructors (fe3f0dc)
  • Timestamp: make sure timestamp is always unsigned (36b2d43)

4.0.2 (2019-03-08)

Bug Fixes
  • buffer: don't use deprecated Buffer constructors (7bb9c57)
  • Buffer: import buffer for binary, decimal128, and fnv1a (6be7b8d)
  • ejson: enable serialization of legacy ObjectID (ba98ccb), closes #​303
  • ejson: support array for replacer parameter in EJSON.stringify (9f43809), closes #​303 #​302 #​303
  • ejson-serialize: prevent double serialization for nested documents (ab790c9), closes #​303
  • object-id: correct serialization of old ObjectID types (8d57a8c)
  • timestamp: getTimestamp support times beyond 2038 (a0820d5)
  • 4.x-1.x interop (incl. ObjectID _bsontype) (f4b16d9)

4.0.1 (2018-12-06)

Bug Fixes
  • object-id: correct serialization of old ObjectID types (8d57a8c)

v4.0.4

Compare Source

Bug Fixes
  • improve EJSON generation for previously skipped edge cases (30f5a8f)
  • only upgrade symbol to string if promoteValues is true (067a7ba)

v4.0.3

Compare Source

Bug Fixes
  • support Number object in Int32 and Double constructors (fe3f0dc)
  • Timestamp: make sure timestamp is always unsigned (36b2d43)

v4.0.2

Compare Source

Bug Fixes
  • buffer: don't use deprecated Buffer constructors (7bb9c57)
  • Buffer: import buffer for binary, decimal128, and fnv1a (6be7b8d)
  • ejson: enable serialization of legacy ObjectID (ba98ccb), closes #​303
  • ejson: support array for replacer parameter in EJSON.stringify (9f43809), closes #​303 #​302 #​303
  • ejson-serialize: prevent double serialization for nested documents (ab790c9), closes #​303
  • object-id: correct serialization of old ObjectID types (8d57a8c)
  • timestamp: getTimestamp support times beyond 2038 (a0820d5)
  • 4.x-1.x interop (incl. ObjectID _bsontype) (f4b16d9)

v4.0.1

Compare Source

Bug Fixes
  • object-id: correct serialization of old ObjectID types (8d57a8c)

v4.0.0

Compare Source

Migration Guide

Please see the migration guide for detailed discussion of breaking changes in this release.

Bug Fixes
  • buffer: replace deprecated Buffer c

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@renovate renovate bot force-pushed the renovate/bson-6.x branch from 1f65f97 to 2625a6e Compare June 6, 2025 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants