Closed losintikfos closed 3 years ago
I have this model
use wither::prelude::*; #[derive(Debug, Clone, Model, PartialEq, Deserialize, Serialize, TypedBuilder)] #[model(collection_name = "accounts")] #[model(index( keys = r#"doc!{"email": 1}"#, options = r#"doc!{"name": "unique-email", "unique": true, "background": true}"# ))] pub struct Account { #[serde(rename = "_id", skip_serializing_if = "Option::is_none")] pub(crate) id: Option<ObjectId>, pub(crate) email: Option<String>, pub(crate) created: Option<String>, pub(crate) updated: Option<String>, }
I have noticed below call always return None although the value exists. Does anyone knows why this is happening?
None
let filter = Some(bson::doc! { "email": String::from("my.email@example.com") }); let select_option = Account::find_one(&db, filter, None).await.map_err(|err| { anyhow!("DB Error: :?}", err) })? println!("Verify: {:?}", select_option); // <-- Prints None
This was totally a bug in my code nothing to do with wither apologies.
wither
@losintikfos copy that. Sounds good :)
:)
I have this model
I have noticed below call always return
None
although the value exists. Does anyone knows why this is happening?