From 9d4fea29370e7af1dd1f2683cc73c40ce403dfa8 Mon Sep 17 00:00:00 2001 From: Jeb Rosen Date: Tue, 14 Jul 2020 11:20:49 -0700 Subject: [PATCH] Remove 'mongodb' integration from 'contrib'. The latest version of 'mongodb' is async and implements its own internal connection pooling. --- contrib/lib/Cargo.toml | 3 --- contrib/lib/src/databases.rs | 17 ----------------- scripts/test.sh | 1 - site/guide/6-state.md | 3 --- 4 files changed, 24 deletions(-) diff --git a/contrib/lib/Cargo.toml b/contrib/lib/Cargo.toml index 3e931726..2cea1959 100644 --- a/contrib/lib/Cargo.toml +++ b/contrib/lib/Cargo.toml @@ -36,7 +36,6 @@ postgres_pool = ["databases", "postgres", "r2d2_postgres"] mysql_pool = ["databases", "mysql", "r2d2_mysql"] sqlite_pool = ["databases", "rusqlite", "r2d2_sqlite"] redis_pool = ["databases", "redis", "r2d2_redis"] -mongodb_pool = ["databases", "mongodb", "r2d2-mongodb"] memcache_pool = ["databases", "memcache", "r2d2-memcache"] [dependencies] @@ -71,8 +70,6 @@ rusqlite = { version = "0.23", optional = true } r2d2_sqlite = { version = "0.16", optional = true } redis = { version = "0.15", optional = true } r2d2_redis = { version = "0.13", optional = true } -mongodb = { version = "0.3.12", optional = true } -r2d2-mongodb = { version = "0.2.0", optional = true } memcache = { version = "0.14", optional = true } r2d2-memcache = { version = "0.5", optional = true } diff --git a/contrib/lib/src/databases.rs b/contrib/lib/src/databases.rs index 162223d2..86f14035 100644 --- a/contrib/lib/src/databases.rs +++ b/contrib/lib/src/databases.rs @@ -346,7 +346,6 @@ //! | Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | //! | Sqlite | [`Rusqlite`] | `0.23` | [`rusqlite::Connection`] | `sqlite_pool` | //! | Redis | [`redis-rs`] | `0.15` | [`redis::Connection`] | `redis_pool` | -//! | MongoDB | [`mongodb`] | `0.3.12` | [`mongodb::db::Database`] | `mongodb_pool` | //! | Memcache | [`memcache`] | `0.14` | [`memcache::Client`] | `memcache_pool` | //! //! [Diesel]: https://diesel.rs @@ -362,8 +361,6 @@ //! [Rust-Postgres]: https://github.com/sfackler/rust-postgres //! [`rust-mysql-simple`]: https://github.com/blackbeam/rust-mysql-simple //! [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html -//! [`mongodb`]: https://github.com/mongodb-labs/mongo-rust-driver-prototype -//! [`mongodb::db::Database`]: https://docs.rs/mongodb/0.3.12/mongodb/db/type.Database.html //! [`memcache`]: https://github.com/aisk/rust-memcache //! [`memcache::Client`]: https://docs.rs/memcache/0.14/memcache/struct.Client.html //! @@ -416,9 +413,6 @@ use self::r2d2::ManageConnection; #[cfg(feature = "redis_pool")] pub extern crate redis; #[cfg(feature = "redis_pool")] pub extern crate r2d2_redis; -#[cfg(feature = "mongodb_pool")] pub extern crate mongodb; -#[cfg(feature = "mongodb_pool")] pub extern crate r2d2_mongodb; - #[cfg(feature = "memcache_pool")] pub extern crate memcache; #[cfg(feature = "memcache_pool")] pub extern crate r2d2_memcache; @@ -795,17 +789,6 @@ impl Poolable for redis::Connection { } } -#[cfg(feature = "mongodb_pool")] -impl Poolable for mongodb::db::Database { - type Manager = r2d2_mongodb::MongodbConnectionManager; - type Error = DbError; - - fn pool(config: DatabaseConfig<'_>) -> Result, Self::Error> { - let manager = r2d2_mongodb::MongodbConnectionManager::new_with_uri(config.url).map_err(DbError::Custom)?; - r2d2::Pool::builder().max_size(config.pool_size).build(manager).map_err(DbError::PoolError) - } -} - #[cfg(feature = "memcache_pool")] impl Poolable for memcache::Client { type Manager = r2d2_memcache::MemcacheConnectionManager; diff --git a/scripts/test.sh b/scripts/test.sh index 210f2bfc..5ee3f49b 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -76,7 +76,6 @@ if [ "$1" = "--contrib" ]; then mysql_pool sqlite_pool redis_pool - mongodb_pool memcache_pool brotli_compression gzip_compression diff --git a/site/guide/6-state.md b/site/guide/6-state.md index fe77f6db..bbac0716 100644 --- a/site/guide/6-state.md +++ b/site/guide/6-state.md @@ -236,7 +236,6 @@ Presently, Rocket provides built-in support for the following databases: | Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | | Sqlite | [`Rusqlite`] | `0.23` | [`rusqlite::Connection`] | `sqlite_pool` | | Redis | [`redis-rs`] | `0.15` | [`redis::Connection`] | `redis_pool` | -| MongoDB | [`mongodb`] | `0.3.12` | [`mongodb::db::Database`] | `mongodb_pool` | | Memcache | [`memcache`] | `0.14` | [`memcache::Client`] | `memcache_pool` | [`r2d2`]: https://crates.io/crates/r2d2 @@ -253,8 +252,6 @@ Presently, Rocket provides built-in support for the following databases: [Rust-Postgres]: https://github.com/sfackler/rust-postgres [`rust-mysql-simple`]: https://github.com/blackbeam/rust-mysql-simple [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html -[`mongodb`]: https://github.com/mongodb-labs/mongo-rust-driver-prototype -[`mongodb::db::Database`]: https://docs.rs/mongodb/0.3.12/mongodb/db/type.Database.html [`memcache`]: https://github.com/aisk/rust-memcache [`memcache::Client`]: https://docs.rs/memcache/0.14/memcache/struct.Client.html