-
Type: Bug
-
Resolution: Won't Do
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Embedded Shell
-
None
-
Environment:Fedora 35, Rust 1.58.0
-
Not Needed
Problem Statement/Rationale
If we create a struct which will be used as a collection generic type, and we set the '#[serde(serialize_with = "serialize_object_id_as_hex_string")]' serde helper for the '_id' field (or an other ObjectId field). Then we can not query that field with an ObjectId only with its hex representation.
Steps to Reproduce
Consider the following struct:
pub struct User {
#[serde(serialize_with = "serialize_object_id_as_hex_string")]
pub _id: ObjectId,
pub email: String,
pub password: String,
pub username: String,
}
Now, if try to query a collection using this as the generic type, then query will not give any result:
let id = ObjectId::from_str(&id)let filter = doc!{"_id": ObjectId::from};
{{ let update = doc!{"$set": {"confirmed": true}};}}
users_coll.update_one(filter, update, None).await
.map_err(|_| ErrorInternalServerError(""))?;
Expected Results
What do you expect to happen?
Actual Results
What do you observe is happening?
Additional Notes
Any additional information that may be useful to include.