pub trait GridFSDb: MongoClient {
// Provided method
fn create_bucket(&self) -> GridFSBucket { ... }
}
Expand description
Trait that is implemented automatically on all Database handlers.
Feature flag “mongodb-gridfs” is needed to use this trait.
use mongodb_ext::{mongo_db, GridFSDb, MongoClient};
use mongodb_gridfs::GridFSBucket;
use tokio_test::block_on;
mongo_db! {
SomeDatabase {
SomeCollection {
some_field: String
}
}
}
use mongo::SomeDatabase;
// using `tokio::block_on` to run async code in tests
let db: SomeDatabase = block_on(SomeDatabase::new("mongodb://example.com")).unwrap();
let bucket: GridFSBucket = db.create_bucket();
Provided Methods§
Sourcefn create_bucket(&self) -> GridFSBucket
fn create_bucket(&self) -> GridFSBucket
Creates a mongodb GridFS bucket.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.