[][src]Crate mongod_derive

Mongo Derive

This crate provides two derives Bson & Mongo for the mongo crate.

Examples

Deriving BSON

#[derive(Bson)]
pub struct User {
    name: String,
    age: u32,
}

Deriving Mongo

#[derive(Mongo)]
#[mongo(collection = "users", field, filter, update)]
pub struct User {
    name: String,
    age: u32,
}

Derive Macros

Bson

Derives implementations for TryFrom so that the decorated type can be converted to & from BSON.

Mongo

Derives mongo traits on the decorated type.