framework_cqrs_lib/cqrs/infra/daos/database_mongo.rs
use mongodb::{Client, Database};
pub struct DatabaseMongo {
pub underlying: Database,
}
impl DatabaseMongo {
pub async fn new(dbname: &str) -> Self {
let uri = std::env::var("MONGO_URI").unwrap();
let client: Client = Client::with_uri_str(uri.clone()).await.unwrap();
let db: Database = client.database(dbname);
Self {
underlying: db
}
}
}