https://github.com/dax-dot-gay/manor
Highly-automated MongoDB ORM
https://github.com/dax-dot-gay/manor
gridfs mongodb orm rust
Last synced: 4 months ago
JSON representation
Highly-automated MongoDB ORM
- Host: GitHub
- URL: https://github.com/dax-dot-gay/manor
- Owner: dax-dot-gay
- License: mit
- Created: 2025-03-11T14:37:58.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-23T19:08:52.000Z (about 1 year ago)
- Last Synced: 2025-11-12T00:25:26.740Z (7 months ago)
- Topics: gridfs, mongodb, orm, rust
- Language: Rust
- Homepage: https://crates.io/crates/manor
- Size: 72.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `manor` - MongoDB for Rust, Simplified
 
A highly-automated MongoDB ORM, extending on the `mongodb` crate to bring tighter GridFS integration, cross-document linking, and extremely low-code schema specification.
> Note: Currently not tested exhaustively, and likely not ready for production. Still under active development.
### Installation
```bash
cargo add manor
```
### Example Usage
A (very) brief example of this crate's usage is as follows:
```rust
use manor::{schema, Client, Collection};
use uuid::Uuid;
// Set up a schema, defines [User] and [UserBuilder]
#[schema(collection = "users")]
pub struct User {
#[field(id = Uuid::new_v4)]
pub id: Uuid,
pub username: String,
pub password: String
}
#[tokio::main]
async fn main() -> Result<(), Box> {
// Initialize a client and assign it to the global instance
Client::connect_with_uri("mongodb://...", "my_app")?.as_global();
let user = UserBuilder::default().username("alice").password("bob").build()?;
user.save().await?;
let users = Collection::::new();
for user in users.find_many(bson::doc! {}).await {
println!("{user:?}");
}
Ok(())
}
```