7 releases

Uses old Rust 2015

0.2.2 Jan 9, 2019
0.2.1 Jan 8, 2019
0.2.0 Dec 4, 2018
0.1.3 Jun 29, 2018

#24 in #mongodb

Download history 54/week @ 2024-04-14 53/week @ 2024-04-21 49/week @ 2024-04-28 44/week @ 2024-05-05 46/week @ 2024-05-12 52/week @ 2024-05-19 49/week @ 2024-05-26 56/week @ 2024-06-02 31/week @ 2024-06-09 39/week @ 2024-06-16 41/week @ 2024-06-23 9/week @ 2024-06-30 39/week @ 2024-07-07 38/week @ 2024-07-14 24/week @ 2024-07-21 126/week @ 2024-07-28

227 downloads per month
Used in 2 crates

GPL-3.0 license

16KB
189 lines

crates.io docs.rs

r2d2-mongodb

A MongoDB adaptor for r2d2 connection pool.

Documentation

In progress...

Example usage

Start mongodb:

$ docker run --rm -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=password -e MONGO_INITDB_DATABASE=mydb mongo:latest
extern crate r2d2;
extern crate r2d2_mongodb;

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

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

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

    // ...
}

Dependencies

~12–19MB
~290K SLoC