bson
Encoding and decoding support for BSON in Rust
3.1.0
23M downloads/mo
#1933 most downloaded on crates.io
mongodb/bson-rust
What this package is like to depend on
Last release 9 months ago
20 Nov 2025
Ships fairly regularly
a new release about every 3 months
Rarely documented
notes for 10 of 62 stable releases
2 versions withdrawn
withdrawn after publishing
11 years old
72 releases · first in 2015
1 release in the last 12 months
see the full history below
Release timeline
72 releases · Jun 2015 to Nov 2025Releases
latest 60 of 72-
3.1.020 Nov 2025Release notes
Open source →The MongoDB Rust driver team is pleased to announce the v3.1.0 release of the
bsoncrate.Full Release Notes
See this GitHub query for a full list of changes.
New Features
- Add const array bson conversion (#601)
-
3.0.025 Aug 2025Release notes
Open source →The MongoDB Rust driver team is pleased to announce the v3.0.0 release of the
bsoncrate.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::Errortype, with fields for values common across errors like message or associated key and akindenum that provides granular root cause information. &CStr: Thebsoncrate 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 withserdeis 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 theserdecrate).
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)
- Unified Error Hierarchy: 3.0 adds the
-
2.15.020 May 2025Release notes
Open source →The MongoDB Rust driver team is pleased to announce the v2.15.0 release of the
bsoncrate.Full Release Notes
This release adds a contributed
uncapped_max_sizefeature; when enabled, this increases the maximum size of a document from 16 MB to 2 GB.New Features
- add
uncapped_max_sizefeature to allow increasing max BSON size (#528) (thanks @Trevader24135!)
- add
-
2.14.013 Mar 2025Release notes
Open source →The MongoDB Rust driver team is pleased to announce the v2.14.0 release of the
bsoncrate.Highlighted Changes
This release adds:
- the
bson::binary::Vectortype, providing efficient support for including
densely packed arrays of numeric values in BSON documents, - functions to
DateTimeto add milliseconds andDuration, Indeximpls forBsonandDocument, 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
- the
-
2.13.019 Sep 2024Release notes
Open source →The MongoDB Rust driver team is pleased to announce the v2.13.0 release of the
bsoncrate.Highlighted Changes
This release introduces a utility type for deserializing from UTF-8 lossy BSON bytes.
Full Release Notes
New Features
-
2.12.011 Sep 2024Release notes
Open source →The MongoDB Rust driver team is pleased to announce the v2.12.0 release of the
bsoncrate.Highlighted Changes
This release was largely driven by external contributions!
- An optional implementation of
HashandEqfor theBsonfamily of types ObjectId::from_parts, allowing direct construction of anObjectIdfrom 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_errorcrate, 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!)
- An optional implementation of
-
2.11.005 Jun 2024Release notes
Open source →The MongoDB Rust driver team is pleased to announce the v2.11.0 release of the
bsoncrate.Highlighted Changes
This release introduces the
HumanReadablehelper type; this provides more flexible control than thehuman_readableoption, which is now deprecated.Full Release Notes
New Features
Bugfixes
-
2.10.002 Apr 2024Release notes
Open source →The MongoDB Rust driver team is pleased to announce the v2.10.0 release of the
bsoncrate.Highlighted Changes
This release adds several bugfixes and the
RawDocumentBuf::append_refmethod, 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)
-
2.9.025 Jan 2024Release notes
Open source →The MongoDB Rust driver team is pleased to announce the v2.9.0 release of the
bsoncrate.Highlighted Changes
This release adds several externally contributed improvements!
- A new
RawItertype that iterates over elements in a document without deserializing them, - An improvement to the
docandbsonmacros (and theirrawcounterparts) that allows using types that implementInto<Bson>orInto<RawBson>, - An impl of
From<&mut T>forBsonfor types that implementInto<Bson>, - A smaller dependency tree thanks to updating the indexmap crate,
- And a fix for the
serde_with3.x support for theUuidtype.
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
- A new
-
2.8.112 Dec 2023Release notes
Open source →The MongoDB Rust driver team is pleased to announce the v2.8.1 release of the
bsoncrate.Highlighted Changes
This release fixes compilation for the
wasm32-wasitarget, which broke in the 2.8.0 release.Full Release Notes
Bugfixes
-
2.8.011 Dec 2023Nothing published for this version
-
2.7.030 Aug 2023Nothing published for this version
-
2.6.120 Mar 2023Nothing published for this version
-
2.6.013 Mar 2023Nothing published for this version
-
2.5.012 Jan 2023Nothing published for this version
-
2.4.002 Aug 2022Nothing published for this version
-
2.3.003 Jun 2022Nothing published for this version
-
2.2.014 Apr 2022Nothing published for this version
-
2.2.0-beta.131 Mar 2022 pre-releaseNothing published for this version
-
2.2.0-beta25 Mar 2022 pre-releaseNothing published for this version
-
2.1.014 Dec 2021Nothing published for this version
-
2.1.0-beta16 Nov 2021 pre-releaseNothing published for this version
-
2.0.112 Oct 2021Nothing published for this version
-
2.0.007 Sep 2021Nothing published for this version
-
2.0.0-beta.306 Aug 2021 pre-releaseNothing published for this version
-
2.0.0-beta.225 Jun 2021 pre-releaseNothing published for this version
-
2.0.0-beta.101 Jun 2021 pre-releaseNothing published for this version
-
2.0.0-beta14 May 2021 pre-releaseNothing published for this version
-
1.2.412 Oct 2021Nothing published for this version
-
1.2.306 Aug 2021Nothing published for this version
-
1.2.207 Apr 2021Nothing published for this version
-
1.2.106 Apr 2021Nothing published for this version
-
1.2.012 Feb 2021Nothing published for this version
-
1.1.018 Aug 2020Nothing published for this version
-
1.1.0-beta30 Jul 2020 pre-releaseNothing published for this version
-
1.0.008 Jun 2020Nothing published for this version
-
0.15.003 Jun 2020Nothing published for this version
-
0.14.117 Mar 2020Nothing published for this version
-
0.14.031 Aug 2019Nothing published for this version
-
0.13.128 Aug 2019 withdrawnNothing published for this version
-
0.13.011 Aug 2018Nothing published for this version
-
0.12.330 Jul 2018Nothing published for this version
-
0.12.211 Jul 2018Nothing published for this version
-
0.12.103 Jul 2018Nothing published for this version
-
0.12.003 Jul 2018Nothing published for this version
-
0.11.123 Feb 2018Nothing published for this version
-
0.11.010 Jan 2018Nothing published for this version
-
0.10.002 Oct 2017Nothing published for this version
-
0.9.130 Sep 2017Nothing published for this version
-
0.9.023 Jun 2017Nothing published for this version
-
0.8.030 May 2017Nothing published for this version
-
0.7.117 May 2017Nothing published for this version
-
0.7.023 Apr 2017Nothing published for this version
-
0.6.111 Apr 2017Nothing published for this version
-
0.6.015 Mar 2017Nothing published for this version
-
0.5.012 Mar 2017Nothing published for this version
-
0.4.404 Mar 2017Nothing published for this version
-
0.4.326 Feb 2017Nothing published for this version
-
0.4.224 Feb 2017Nothing published for this version
-
0.4.120 Feb 2017 withdrawnNothing published for this version