MongoDB Rust Driver

This is the official MongoDB Rust Driver.

See Installation

Select from the Sync or Async tabs below for corresponding connection code samples.

To connect to a MongoDB Atlas cluster, use the Atlas connection string for your cluster:

To connect to a database running locally on its default port, change the connection string to "mongodb://localhost".

To connect to a database running locally, change the connection string to "mongodb://localhost:<port>".

Your mongod instance must be running to successfully connect to your database. For information on how to start your mongod instance, see the Manage mongod Processes Server Manual Entry.


The Rust driver is currently missing some features such as explicit sessions which prevents you from creating transactions and ensuring causal consistency. We plan to make this driver consistent with our other drivers in the future.

Rust Driver Version
MongoDB 4.4
MongoDB 4.2
MongoDB 4.0
MongoDB 3.6

The Rust driver is not compatible with MongoDB server versions older than 3.6.

(*) Not all features in MongoDB 4.4 are available in this version of the driver including OCSP. These features will be included in future versions of the driver.

The MongoDB Rust driver requires Rust 1.43 or later.

For more information on how to read the compatibility tables, see our guide on MongoDB Compatibility Tables.

Give Feedback

On this page

  • Introduction
  • Installation
  • Connect to MongoDB Atlas
  • Connect to localhost
  • Compatibility