Derive Macro Column

Source
#[derive(Column)]
{
    // Attributes available to this derive:
    #[dropIndexes]
    #[singleIndex]
    #[compoundIndex]
    #[multikeyIndex]
}
Expand description

Column Derive宏,用于收集结构体元信息,以及初始化mongodb的索引

每次修改索引时,默认不删除全部索引,但会尝试删除老的索引

属性列表

§Example

#[derive(Debug, Clone, Column)]
#[dropIndexes]
struct User {
    #[singleIndex(unique)]
    name: String,
    #[compoundIndex(unique, other_fields(name))]
    age: i32,
    #[multikeyIndex(unique, field_name = "age")]
    address: String,
}