pub fn from_document_with_options<T>(
    doc: Document,
    options: DeserializerOptions
) -> Result<T>where
    T: DeserializeOwned,
Expand description

Deserialize a T from the provided Document, configuring the underlying deserializer with the provided options.

#[derive(Debug, Deserialize, PartialEq)]
struct MyData {
    a: String,
}

let doc = doc! { "a": "hello" };
let options = DeserializerOptions::builder().human_readable(false).build();
let data: MyData = bson::from_document_with_options(doc, options)?;
assert_eq!(data, MyData { a: "hello".to_string() });