-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
While writing some test assertions for a web app, I faced an issue with comparing two structs with timestamp fields using `Bson:: DateTime`: The first one being the struct before being serialized and stored in the DB and the second one being the struct after being fetched from the DB and deserialized. The thing is, that the timestamps do not match, because before the serialization, the timestamp has precision to the nanosecond level, while after being serialized, it has precision to the millisecond level.
After diving into the docs for Chrono, it seems that the implementation changed in some recent version:
```
// Version 0.4.5
#[derive(Deserialize, Serialize)]
struct S
// Version 0.4.12
#[derive(Deserialize, Serialize)]
struct S
```
This makes me wonder if the bson library is using an old version of Chrono, since I couldn't find any custom implementation for the `Serialize` trait on the `DateTime` Struct.
- is related to
-
RUST-815 Truncate chrono::DateTime to millisecond precision when converting to bson::DateTime
- Closed