Skip to content
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

chore(main): release 6.7.0 [skip-ci] #672

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Apr 17, 2024

🌱 A new release!

6.7.0 (2024-05-01)

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

Release Notes

Add Long.fromStringStrict method

The Long.fromStringStrict method is almost identical to the Long.fromString method, except it throws a BSONError if any of the following are true:

  • input string has invalid characters, for the given radix
  • the string contains whitespace
  • the value the input parameters represent is too large or too small to be a 64-bit Long

Unlike Long.fromString, this method does not coerce the inputs '+/-Infinity' and 'NaN' to Long.ZERO, in any case.

Examples:

Long.fromStringStrict('1234xxx5'); // throws BSONError
Long.fromString('1234xxx5'); // coerces input and returns new Long(123400)

// when writing in radix 10, 'n' and 'a' are both invalid characters
Long.fromStringStrict('NaN'); // throws BSONError
Long.fromString('NaN'); // coerces input and returns Long.ZERO

Note

Long.fromStringStrict's functionality will be present in Long.fromString in the V7 BSON release.

Add static Double.fromString method

This method attempts to create an Double type from a string, and will throw a BSONError on any string input that is not representable as a IEEE-754 64-bit double.
Notably, this method will also throw on the following string formats:

  • Strings in non-decimal and non-exponential formats (binary, hex, or octal digits)
  • Strings with characters other than sign, numeric, floating point, or slash characters (Note: 'Infinity', '-Infinity', and 'NaN' input strings are still allowed)
  • Strings with leading and/or trailing whitespace
    Strings with leading zeros, however, are also allowed.

Add static Int32.fromString method

This method attempts to create an Int32 type from string, and will throw a BSONError on any string input that is not representable as an Int32.
Notably, this method will also throw on the following string formats:

  • Strings in non-decimal formats (exponent notation, binary, hex, or octal digits)
  • Strings with non-numeric and non-leading sign characters (ex: '2.0', '24,000')
  • Strings with leading and/or trailing whitespace

Strings with leading zeros, however, are allowed

UTF-8 validation now throws a BSONError on overlong encodings in Node.js

Specifically, this affects deserialize when utf8 validation is enabled, which is the default.

An overlong encoding is when the number of bytes in an encoding is inflated by padding the code point with leading 0s (see here for more information).

Long.fromString takes radix into account before coercing '+/-Infinity' and 'NaN' to Long.ZERO

Long.fromString no longer coerces the following cases to Long.ZERO when the provided radix supports all characters in the string:

  • '+Infinity', '-Infinity', or 'Infinity' when 35 <= radix <= 36
  • 'NaN' when 24 <= radix <= 36
// when writing in radix 27, 'n' and 'a' are valid characters, so 'NaN' represents the decimal number 17060
Long.fromString('NaN', 27); // new Long(17060)
Long.fromString('NaN', 10); // new Long(0) <-- Since 'NaN' is not a valid input in base 10, it gets coerced to Long.ZERO

Features

Bug Fixes

Documentation

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


@github-actions github-actions bot force-pushed the release-please--branches--main--components--bson branch 3 times, most recently from 66fc6de to 30e8579 Compare April 19, 2024 16:43
@github-actions github-actions bot force-pushed the release-please--branches--main--components--bson branch 2 times, most recently from 11c595f to cc15b65 Compare April 30, 2024 19:11
@github-actions github-actions bot force-pushed the release-please--branches--main--components--bson branch from cc15b65 to a9e5f3c Compare May 1, 2024 19:33
@aditi-khare-mongoDB
Copy link
Contributor

run release_notes

@aditi-khare-mongoDB aditi-khare-mongoDB self-requested a review May 2, 2024 17:14
@baileympearson baileympearson merged commit 370396e into main May 2, 2024
@baileympearson baileympearson deleted the release-please--branches--main--components--bson branch May 2, 2024 18:36
Copy link
Contributor Author

github-actions bot commented May 2, 2024

🤖 Release is at https://github.com/mongodb/js-bson/releases/tag/v6.7.0 🌻

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.

2 participants