-
Notifications
You must be signed in to change notification settings - Fork 189
Description
Versions/Environment
- What version of Rust are you using? - 1.65.0
- What operating system are you using? - WSL (Linux on windows)
- What versions of the driver and its dependencies are you using? (Run
cargo pkgid mongodb&cargo pkgid bson) - [email protected] & [email protected] - What version of MongoDB are you using? (Check with the MongoDB shell using
db.version()) - 5.0.14 - What is your MongoDB topology (standalone, replica set, sharded cluster, serverless)? - Replica Set - 3 nodes
Describe the bug
A clear and concise description of what the bug is.
I am attempting to query for a document that is giving me an error about "invalid utf-8 sequence". I've done a lot of googling on this issue but no luck so far. Nothing related to mongodb :(
The document is quite large, so that might be a potential issue, but I'm not sure.
I'm able to query for another document from the same collection without issue, and that document is also quite large, so I'm not sure if the size is the issue.
I have removed all the properties from the struct so I'm not trying to deserliaze anything at this point, just get the document successfully - and I still get this error. 😢
My next move is to manually delete much of the data out of the document or query for a different document... but obviously none of this is ideal. I'd just like to get someone to point me in the right direction on what the cause of this error might be.
Also important to note is I use Mongodb App Services(formerly Realm, formerly Stitch) and I ran schema validations across these documents and everything passes.
Here's the code, but I don't think it helps much:
// manually setting ID for the query
let id = ObjectId::from_str("6116dc1633616dc8924e1050").unwrap();
let filter_document = doc! {"userId": id};
let find_one_options = FindOneOptions::builder().build();
let profile = self
.profiles_repository
.find_one::<Profile >(filter_document, find_one_options)
.await;
//inside find_one
async fn find_one<'b, T: DeserializeOwned + Sync + Send + Unpin>(
&self,
filter: Document,
find_one_options: FindOneOptions,
) -> Result<Option<T>, Error> {
let collection = self
.client
.database("Occasionally")
.collection::<T>("Profiles");
collection.find_one(filter, find_one_options).await
}
// Profile Struct, commented out all the props :(
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Profile {
// pub other_id: Option<ObjectId>,
// pub complex_prop: Vec<OtherStruct>,
// pub user_id: Option<ObjectId>,
}
Any help is greatly appreciated and please let me know if I can provide any other information.