v4.7.0
The MongoDB Node.js team is pleased to announce version 4.7.0 of the bson package!
Release Highlights
This release adds automatic UUID support. Now when serializing or deserializing BSON you can work directly with the UUID type without explicit conversion methods. The UUID class is now a subclass of binary so all existing code will continue to work (including the explicit conversion methods .toUUID
/.toBinary
). The same automatic support for UUID is also present in EJSON .parse
/.stringify
.
Take a look at the following for the expected behavior:
const document = BSON.deserialize(bytes)
// { uuid: UUID('xxx') }
BSON.serialize(document)
// Buffer < document with uuid (binary subtype 4) >
Special thanks to @aditi-khare-mongoDB for all her hard work on this feature!! 🎉
Features
- NODE-4405: support serializing UUID class (#508) (f5dc9ed)
- NODE-4419: UUID class deserialization (#509) (ff2b975)
- NODE-4506: Make UUID a subclass of binary (#512) (e9afa9d)
- NODE-4535: automatically promote UUIDs when deserializing and parsing UUIDs (#513) (1dc7eae)
Documentation
- API: https://github.com/mongodb/js-bson#readme
- Changelog: https://github.com/mongodb/js-bson/blob/main/HISTORY.md#change-log
We invite you to try the bson library immediately, and report any issues to the NODE project.