pub fn to_doc<T>(value: T) -> DocumentExpand description
将结构体转换可以直接插入的doc参数 Note: 注意你的数据类型中尽量不要使用 u8等数据类型,他会导致bson无法解析结构体. 参见 https://github.com/mongodb/bson-rust/issues/89 Examples
use qifi_rs::to_doc;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Clone, Deserialize, Debug)]
struct Name {
hello:String
}
let x = to_doc(Name{ hello:"somewheve".to_string()});
println!("{:?}", x)