v2.2.0
Description
The MongoDB Rust driver team is pleased to announce the v2.2.0 release of the bson
crate.
Highlighted Changes
The following sections detail some of the more important changes included in this release. For a full list of changes, see the Full Release Notes section below.
Raw BSON (RUST-284, RUST-1045, RUST-1082, RUST-1109, RUST-1111, RUST-1119)
Both of the existing ways of working with BSON values (the BSON
type or using Serde) require parsing the values up-front. This can be a performance bottleneck in certain circumstances; to address this, we've introduced the RawBson
, RawDocument
, and RawArray
types.
These types provide an interface similar to the existing BSON types, but are backed by a buffer of BSON bytes rather than a fully parsed enum
or hash map. This enables zero-copy reads with minimal parsing and highly memory-efficient manipulation.
In tradeoff, these types do not provide the full set of operations that the standard ones can, and the performance of element access is O(N) rather than then average O(1) of the parsed types.
Thanks to @jcdyer for contributing the initial implementation!
Full Release Notes
New Features
- RUST-284 Incorporate raw BSON code from rawbson = "0.2.1" in mod raw (#229)
- RUST-1045 Support appending to RawDocumentBuf (#326)
- RUST-1109 Implement rawbson! and rawdoc! macros (#329)
- RUST-1119 Add bson::to_raw_document_buf function (#330)
- RUST-1111 Support deserializing RawBson from Bson (#331)
- minor: raw BSON perf and API improvements (#335)