[][src]Crate r2d2_mongodb

r2d2-mongodb

A MongoDB adaptor for r2d2 connection pool.

Example

extern crate r2d2;
extern crate r2d2_mongodb;

use r2d2::Pool;
use r2d2_mongodb::{ConnectionOptionsBuilder, MongodbConnectionManager};

fn main () {
    let manager = MongodbConnectionManager::new(
        ConnectionOptionsBuilder::new()
            .with_host("localhost", 27017)
            .with_db("mydb")
            .with_auth("root", "password")
            .build()
    );

    // let pool = Pool::builder()
    //     .max_size(16)
    //     .build(manager)
    //     .unwrap();

    // ...
}

Re-exports

pub extern crate mongodb;
pub extern crate r2d2;

Structs

Auth
ConnectionOptions

Options with which the connections to MongoDB will be created

ConnectionOptionsBuilder

Builder for ConnectionOptions

Host
MongodbConnectionManager

Struct for managing a pool of MongoDB connections