mungos
inspired by the mongoose
npm package, this crate contains the Mungos
struct, a wrapper around the mongodb client containing some additional queries and functionality
usage
let mungos = new.await.unwrap;
let coll = mungos.;
let items: = coll
.get_most_recent
.await
.unwrap;
println!; // prints the 10 most recent docs by timestamp
initializing from environment
# specify full uri directly
MONGO_URI=mongodb://username:password@localhost:27017
## or
# specify uri parts
MONGO_ADDRESS=localhost:27017
MONGO_USERNAME=username
MONGO_PASSWORD=password
# ---------------------
# specify other options
MONGO_APP_NAME=tester # optional. default is 'mungos'
MONGO_TIMEOUT_SECS=30 # optional. default is '3'
MONGO_COMPRESSORS=snappy,zstd(10),zlib(8) # optional. defaults to None
let mungos = new_from_env.await.unwrap;
let coll = mungos.;
let items = coll.get_some.await.unwrap; // Vec<TestDoc>