Crate r2d2_mongodb[][src]

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")
            .with_port(27017)
            .with_db("admin")
            .with_username("root")
            .with_password("password")
            .build()
    );

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

    //...
}

Re-exports

pub extern crate mongodb;
pub extern crate r2d2;

Structs

ConnectionOptions

Options with which the connections to MongoDB will be created

ConnectionOptionsBuilder

Builder for ConnectionOptions

MongodbConnectionManager

Struct for managing a pool of MongoDB connections