Releases: mongodb/bson-rust
v3.0.0
The MongoDB Rust driver team is pleased to announce the v3.0.0 release of the bson
crate.
Highlighted Changes
3.0 updates several APIs in backwards-incompatible ways; in most cases these changes should require only minor updates in application code.
Most notably:
- Unified Error Hierarchy: 3.0 adds the
bson::error::Error
type, with fields for values common across errors like message or associated key and akind
enum that provides granular root cause information. &CStr
: Thebson
crate now provides types that directly model the BSON spec "cstring" type, removing a potential source ofpanic!
s and allowing validation at either run-time or compile-time for constant strings.- Optional
serde
: Integration withserde
is now an optional feature; in support of this, the API has been updated to clarify where methods are for encoding (directly converting Rust BSON values into BSON bytes) or for serialization (converting arbitrary Rust structs to BSON values or bytes via theserde
crate).
For detailed information on breaking changes and code examples, please see the migration guide.
Release Notes
Impactful changes are listed below; for a full list of changes see this GitHub query.
Breaking Changes
- RUST-1906 Remove human readable options (#531)
- RUST-1380 Drop support for uuid 0.8 (#534)
- RUST-2169 Clean up and future-proof features (#544)
- RUST-1887 Convince append to be more accepting (#541)
- RUST-1960 Make large-dates time feature optional (#546)
- RUST-1406 Add crate-wide error types, convert value access errors (#551)
- RUST-1406 Convert raw errors to standard error type (#552)
- RUST-1998 Remove lossy utf8 as a decoder option (#550)
- RUST-1869 Rename RawElement::len to RawElement::size (#557)
- RUST-1992 Make serde an optional feature (#554)
- RUST-1406 Add type-specific errors to standard error type (#555)
- RUST-1406 Convert serde errors to standard error type (#562)
- RUST-1887 Make BindRawBsonRef a little more user-friendly (#565)
- RUST-1748 Convert serde helpers to serde_with::(De)SerializeAs implementations for some converters between ObjectId, String, and DateTime (#559)
- RUST-1992 Introduce the &CStr and CString types for keys and regular expressions (#563)
- RUST-2241 Convert panic from malformed input to error (#568)
- RUST-2240 Move serde_json API behind a feature flag (#567)
- RUST-1748 Convert unsigned serde helpers to use serde_conv (#575)
- RUST-1748 Convert UUID serde helpers to use serde_conv (#579)
- RUST-2228 Normalize conversions between raw types and base crate types (#580)
- RUST-1998 Remove now-redundant to_document_utf8_lossy method (#592)
New Features
- Implement FromStr for Uuid (#561) (thanks @tyilo!)
- RUST-2229 Expose raw deserializer (#584)
- feat: Add integration with jiff::Timestamp (#587) (thanks @dguarascio!)
- RUST-2258 Use borrowed buffer in raw serializer (#590) (thanks @LeWimbes!)
- RUST-2266 Add HashSet to Bson conversion (#598) (thanks @TheDan64!)
Improvements
- minor: remove incorrect note about Decimal128 panic (#539)
- RUST-2215 Ergonomics for HumanReadable (#540)
- RUST-1798 use simd to optimize utf8 validation (#548) (thanks @Liyixin95!)
- RUST-1992 Consolidate binary encoding logic (#560)
- RUST-998 / RUST-2244 Documentation improvements (#581)
- RUST-2196 Require ignored bits in packed bit vector to be 0 (#586)
- RUST-1985 Update bson toplevel rustdoc (#589)
- RUST-2148 Migration guide for bson crate 3.0 (#591)
- RUST-2239 Fix performance of bson 3.0 (#596)
- RUST-2251 document and tidy up serde helpers (#597)
v2.15.0
The MongoDB Rust driver team is pleased to announce the v2.15.0 release of the bson
crate.
Full Release Notes
This release adds a contributed uncapped_max_size
feature; when enabled, this increases the maximum size of a document from 16 MB to 2 GB.
New Features
- add
uncapped_max_size
feature to allow increasing max BSON size (#528) (thanks @Trevader24135!)
v2.14.0
The MongoDB Rust driver team is pleased to announce the v2.14.0 release of the bson
crate.
Highlighted Changes
This release adds:
- the
bson::binary::Vector
type, providing efficient support for including
densely packed arrays of numeric values in BSON documents, - functions to
DateTime
to add milliseconds andDuration
, Index
impls forBson
andDocument
, allowing convenient shorthand element lookup.
This release also updates the MSRV to 1.81.
Full Release Notes
New Features
- RUST-622 Add document square bracket indexing (#503)
- Add functions to DateTime to add milliseconds and Duration (#506) (thanks @tyilo!)
- RUST-2003 Binary vector subtype support (#513)
Improvements
- test(fuzz): read -> write bson (#500) (thanks @LeoDog896!)
- RUST-2019 Respect pretty printing flag for Document and Bson (#501)
- minor: bump clippy version to 1.83.0 (#509)
- New PR with Devin's complete changes (#507)
- RUST-2149 Sync additional vector tests (#514)
- Update base64 dependency (#515) (thanks @barvirm!)
- RUST-2158 update edition & rand crate (#516) (thanks @BiswajitThakur!)
- feat(extjson): parse legacy {"$date": <ms since epoch>} (#519) (thanks @xiangjinwu!)
- RUST-1375 Update bson crate MSRV policy (#520)
Bugfixes
v2.13.0
v2.12.0
The MongoDB Rust driver team is pleased to announce the v2.12.0 release of the bson
crate.
Highlighted Changes
This release was largely driven by external contributions!
- An optional implementation of
Hash
andEq
for theBson
family of types ObjectId::from_parts
, allowing direct construction of anObjectId
from its component values- Helpers for serializing
Option<chrono::DateTime<_>>
asOption<bson::DateTime>
- A fix for a panic when parsing specific malformed input data into a
Decimal128
We've also added optional (off by default) integration with the serde_path_to_error
crate, which
provides paths to the precise point of failure for deserialization of nested data structures.
Full Release Notes
New Features
- RUST-2027 Impl Hash/Eq for BSON (thanks @@NineLord!)
- RUST-2017 Allow constructing an ObjectId from its parts (thanks @tyilo!)
- RUST-1987 Support serializing
Option<chrono::DateTime<_>>
asOption<bson::DateTime>
(thanks @lazureykis!) - RUST-1874 Add optional integration with serde_path_to_error
Improvements
- RUST-1773 Merge duplicate extjson map parsing between OwnedOrBorrowedRawBsonVisitor and SeededVisitor
Bugfixes
- RUST-2028 Fix Decimal128 panic when parsing strings w/o a char boundary at idx 34 (thanks @arthurprs!)
v2.11.0
The MongoDB Rust driver team is pleased to announce the v2.11.0 release of the bson
crate.
Highlighted Changes
This release introduces the HumanReadable
helper type; this provides more flexible control than the human_readable
option, which is now deprecated.
Full Release Notes
New Features
Bugfixes
v2.10.0
The MongoDB Rust driver team is pleased to announce the v2.10.0 release of the bson
crate.
Highlighted Changes
This release adds several bugfixes and the RawDocumentBuf::append_ref
method, providing a method equivalent to append for borrowed data. This can be useful for avoiding the need for intermediate buffers when the source data is borrowed.
Full Release Notes
New Features
Bugfixes
- RUST-1850 Fix a fuzzer failure (#460)
- fix: access iterators from RawDocument without needing to convert to RawDocumentBuf (#462) (thanks @tychoish!)
- fix: export RawElement type (#461) (thanks @tychoish!)
- RUST-1892 Fix timestamp [de]serialization on big-endian machines (#465)
- RUST-1899 Fix UUID string deserialization (#468)
v2.9.0
The MongoDB Rust driver team is pleased to announce the v2.9.0 release of the bson
crate.
Highlighted Changes
This release adds several externally contributed improvements!
- A new
RawIter
type that iterates over elements in a document without deserializing them, - An improvement to the
doc
andbson
macros (and theirraw
counterparts) that allows using types that implementInto<Bson>
orInto<RawBson>
, - An impl of
From<&mut T>
forBson
for types that implementInto<Bson>
, - A smaller dependency tree thanks to updating the indexmap crate,
- And a fix for the
serde_with
3.x support for theUuid
type.
Full Release Notes
New Features
- RUST-1815 provide lazy iterator implementation (thanks @tychoish!)
- RUST-1716 Add BSON Binary Data subtype Sensitive (#454)
Improvements
- RUST-1822 Allow using the {,raw}{bson,doc} with types implementing Into<{,Raw}Bson> (#450) (thanks @tyilo!)
- RUST-1825 Implement From<&mut T> for Bson (#452) (thanks @tyilo!)
- RUST-1814 minor: bump indexmap to 2.1.0 (#448) (thanks @froydnj!)
Bugfixes
v2.8.1
v2.8.0
The MongoDB Rust driver team is pleased to announce the v2.8.0 release of the bson
crate.
Highlighted Changes
This release adds optimizations to the serde
integration that show up to 50% deserialization speed improvement in our benchmarks, as well as a variety of user-submitted fixes.
Full Release Notes
Improvements
- RUST-1132 Implement DeserializeSeed for owned and borrowed raw documents (#433)
- RUST-1780 Bump MSRV to 1.61.0, upgrade ahash to 0.8.5 in
Cargo.lock.msrv
(#436) (thanks @stIncMale!) - minor: use random() directly in gen_process_id (#438) (thanks @pdeva!)