crates.io documentation MIT License

mongodb-macro

MongoDB Macro is a crate with macros for quickly creating structures to work with mongodb

Examples

```rust

use mongodb::{Client, bson::Bson}; use mongodb_macro::Parser;

mongodbmacro::config!(Opts); //equal //mongodbmacro::config!(Opts; "DBNAME", "COLLECTIONNAME","DB_URL");

//or //mongodbmacro::config!(Opts, "MONGO"); //equal //mongodbmacro::config!(Opts; "MONGODBNAME", "MONGOCOLLECTIONNAME","MONGODBURL");

async fn main() -> std::io::Result<()> {

let opts = Opts::parse();

let client = mongodb::Client::with_uri_str(opts.db_url).await.expect("failed to connect");
let db = client.database(&opts.db_name);
let collection = db.collection::<Bson>(&opts.collection_name);

...

} ```

Current version: 0.1.0

License: MIT