https://github.com/liby99/r2d2-mongodb
My Clone of r2d2-mongodb from
https://github.com/liby99/r2d2-mongodb
Last synced: 3 months ago
JSON representation
My Clone of r2d2-mongodb from
- Host: GitHub
- URL: https://github.com/liby99/r2d2-mongodb
- Owner: Liby99
- License: gpl-3.0
- Created: 2019-07-25T15:13:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-25T15:15:36.000Z (almost 6 years ago)
- Last Synced: 2025-01-21T10:51:05.426Z (5 months ago)
- Language: Rust
- Homepage: https://gitlab.com/petoknm/r2d2-mongodb
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://crates.io/crates/r2d2-mongodb)
[](https://docs.rs/r2d2-mongodb)# r2d2-mongodb
A MongoDB adaptor for r2d2 connection pool.
## Documentation
[In progress...](https://docs.rs/r2d2-mongodb)
## Example usage
Start mongodb:
```shell
$ 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
``````rust
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();// ...
}
```