rs-db-driver-mongodb-mongodb 0.1.0
MongoDB: mongodb (the driver, re-exported, with a runnable example)
Install
cargo add rs-db-driver-mongodb-mongodb --registry rupm
In Ruststudio: Packages, search for rs-db-driver-mongodb-mongodb, Install.
Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.
Versions
- 0.1.0 2026-11-23
README
# rs-db-driver-mongodb-mongodb
MongoDB - mongodb: the official async driver
Add it with `rupm add rs-db-driver-mongodb-mongodb` (or `cargo add rs-db-driver-mongodb-mongodb --registry rupm`). The driver `mongodb` is re-exported as `rs_db_driver_mongodb_mongodb::mongodb`.
Also serves: Azure Cosmos DB for MongoDB, Amazon DocumentDB, FerretDB
This driver is async: your project also needs an async runtime, for example `cargo add tokio --features macros,rt-multi-thread`.
## Example
```rust
use mongodb::bson::{doc, Document};
use mongodb::Client;
#[tokio::main]
async fn main() -> mongodb::error::Result<()> {
let client = Client::with_uri_str("mongodb://localhost:27017").await?;
let items = client.database("mydb").collection::<Document>("items");
items.insert_one(doc! { "name": "first" }).await?;
let found = items.find_one(doc! { "name": "first" }).await?;
println!("found: {found:?}");
Ok(())
}
```