Overview
In this section, you can identify the changes you must make to your application to upgrade your driver to a new version.
Before you upgrade, perform the following actions:
Ensure the new driver version is compatible with the MongoDB Server versions your application connects to and the Rust versions your application runs on. To view compatibility information, see the Compatibility page.
Address any breaking changes between the current version of the driver your application is using and your planned upgrade version in the Breaking Changes section.
Versioning
Each Rust driver release has a version number in the format
MAJOR.MINOR.PATCH. The Rust driver uses Semantic Versioning (SemVer), which typically means:
Breaking changes and removal of deprecated functionality will be done only in major version releases.
New functionality might be added using feature flags, which must be enabled via an opt-in configuration change. These feature flags may be added in either major or minor releases.
Functionality might be marked as deprecated in either major or minor releases, but will not be removed until the next major release, at the earliest.
Patch version releases will contain only non-breaking fixes and security updates.
Breaking Changes
A breaking change is a modification in a convention or behavior in a specific version of the driver that might prevent your application from working properly if you don't address it before upgrading.
The breaking changes in this section are categorized by the driver version that introduced them. When upgrading driver versions, address all the breaking changes between the current and upgrade versions.
Version 3.5 Deprecations
The Rust driver v3.5 release includes the following deprecations:
Deprecates specifying AWS authentication in the username and password of your connection string and the
AWS_SESSION_TOKENproperty. This functionality will be removed in the next major version of the driver. Update your application to use alternative AWS authentication methods. To learn more about AWS authentication, see the MONGODB-AWS Mechanism section of the Authentication guide.Deprecates the
socketTimeoutMSoption. Use thewTimeoutMSoption instead. To learn more about available connection options, see the Connection Options guide.
Version 3.3 Breaking Changes
The Rust driver v3.3 release includes the following breaking changes:
Drops support for MongoDB Server version 4.0 and raises the minimum supported version to 4.2. Ensure your MongoDB deployment is running version 4.2 or later before upgrading.
Introduces support for version 3.0 of the BSON crate. While the driver uses version 2.15 by default for backwards compatibility, BSON 3.0 includes several backwards-incompatible API changes:
Introduces a unified
bson::error::Errortype that consolidates error handling.Adds
&CStrandCStringtypes for BSON keys and regular expressions.Makes
serdean optional feature that is disabled by default. Serialization and deserialization functions now haveserialize_toordeserialize_fromprefixes.
Version 3.2 Breaking Changes
The Rust driver v3.2 release includes the following breaking changes:
Increases the Minimum Supported Rust Version to 1.71.1. Ensure your development environment uses Rust version 1.71.1 or later.
Version 3.1 Breaking Changes
The Rust driver v3.1 release includes the following breaking changes:
Drops support for MongoDB Server version 3.6 and raises the minimum supported version to 4.0. Ensure your MongoDB deployment is running version 4.0 or later before upgrading.
Version 3.0 Breaking Changes
The Rust driver v3.0 release includes the following breaking changes:
Implements a fluent API that changes how you pass options and start sessions:
Chain option builder methods directly to method calls instead of passing options struct parameters
Chain the
session()method to method calls instead of using methods with_with_sessionsuffixesUse the
run()method for synchronous operations
Removes support for the
async-stdasynchronous runtime. Update your application to use an alternative runtime such as Tokio.Requires the use of a
compatfeature if compiled with theno-default-featuresflag. Therustlsanddns-resolutionfeatures are now optional.Removes support for the
bson-*driver features. Select these features by includingbsonas a direct dependency in your application instead.Removes support for read and write concern constants. Use helper methods to set
ReadConcernandWriteConcernvalues instead.Adds
Send + Syncconstraints to theCollection<T>type.Changes the type of
ReadPreferenceOptionsfields toOption<ReadPreferenceOptions>.Removes the
CollectionOptions::human_readable_serializationoption. Instead of theCollectionOptions::human_readable_serializationoption, use thebson::HumanReadablewrapper type to serialize user data into human-readable form.Renames the
comment_bsonfield tocommentforAggregateOptions,FindOptions, andFindOneOptionsstructs.