You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test_doc is a valid BSON document, however the deserializer doesn't make any distinction between a $timestamp from an actual Timestamp vs. just a document with a $timestamp key. This causes issues with custom Deserialize implementations for data structures, where I can't figure out how to differentiate between a real Timestamp and a Document.
BE SPECIFIC:
What is the expected behavior and what is actually happening?
This should not error, but it does.
The text was updated successfully, but these errors were encountered:
You're right, that shouldn't be an error. This is an unfortunate side effect of how our implementation interacts with serde; the information that the value is a subdocument rather than a timestamp is lost in the parsing. I've filed RUST-1693 to track this.
In the meanwhile, you can use the raw bson types to work around this - if you change your final line to
let deserialized = bson::from_slice::<bson::RawDocumentBuf>(&bson_bytes)?.to_document()?;
Describe the bug
See reproduction below:
This errors with:
test_doc
is a valid BSON document, however the deserializer doesn't make any distinction between a$timestamp
from an actual Timestamp vs. just a document with a$timestamp
key. This causes issues with customDeserialize
implementations for data structures, where I can't figure out how to differentiate between a realTimestamp
and aDocument
.BE SPECIFIC:
The text was updated successfully, but these errors were encountered: