Crate mongo_driver [] [src]

This driver is a thin wrapper around the production-ready Mongo C driver.

It aims to provide a safe and ergonomic Rust interface which handles all the gnarly usage details of the C driver for you. We use Rust's type system to make sure that we can only use the underlying C driver in the recommended way specified in it's documentation.

To get started create a client pool wrapped in an Arc so we can share it between threads. Then pop a client from it you can use to perform operations.

Example

use std::sync::Arc;
use mongo_driver::client::{ClientPool,Uri};

let uri = Uri::new("mongodb://localhost:27017/").unwrap();
let pool = Arc::new(ClientPool::new(uri.clone(), None));
let client = pool.pop();
client.get_server_status(None).unwrap();

See the documentation for the available modules to find out how you can use the driver beyond this.

Modules

client

Client to access a MongoDB node, replica set or sharded cluster.

collection

Access to a MongoDB collection.

cursor

Access to a MongoDB query cursor.

database

Access to a MongoDB database.

flags

Flags to configure various MongoDB operations.

read_prefs

Abstraction on top of the MongoDB connection read prefences.

write_concern

Abstraction on top of the MongoDB connection write concern.

Structs

BsoncError

Error in the underlying C driver.

BulkOperationError

Error returned by a bulk operation that includes a report in the reply document.

CommandAndFindOptions

Options to configure both command and find operations.

InvalidParamsError

Invalid params error that can be reported by the underlying C driver.

Enums

MongoError

Wrapper for all errors that can occur in the driver.

MongoErrorCode

MongoDB error code.

MongoErrorDomain

MongoDB error domain.

Type Definitions

BulkOperationResult

Result that's used in bulk operations.

Result

Result that's used in all functions that perform operations on the database.