notmongo
is a simple embedded database, for when you really want MongoDB, but
running a separate database isn't practical.
All data is kept in-memory. Persistence is achieved by explicitly reading/writing data from/to disk.
```rust // Program start: Read the data from a file let mut db = Database::newfromjson_file("data/database.json", Compression::None)?;
// Get the collection to search in let collection = db.collection_mut("collection-1");
// Build the query let findquery = FindQuery::parsebson(bson::doc!{"foo": "bar"})?;
// Run it println!("{:?}", collection.findone( &findquery, // The query to run &HashMap::new(), // Projection &HashMap::new() // Sorting ));
// Store the database back to disk db.dumptojson_file( "data/database.json", // Path to the output file false, // Use relaxed JSON true, // Format the output 3, // Keep 3 old versions of the file as backup Compression:None )?; ```
notmongo
is really meant as a Python library. The logic is implemented in Rust
in order to achieve adequate performance, but Rust is not this library's primary
target.
With that said, I see no reason why it shouldn't be usable directly from Rust, hence this package.