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
For some reasons I see Bson doesn't deserialize Objected and DateTime to String and i64 respectively, so I think it'd be very helpful if there's an inbuilt helper fn to use with serde's deserialize_with macro attribute to automatically deserialize ObjectId to String and DateTime to i64..
Hi @borngraced, thanks for filling this issue! We have a serde_helpers module that contains functions you can use with the serialize_with and deserialize_with attributes. Included is a hex_string_as_object_id that allows conversion between ObjectIds and strings. We don't, however, have helpers for converting between DateTimes and i64s, so I've filed RUST-1540 to add them. If you're interesting in contributing to the BSON library, feel free to make a pull request implementing this functionality.
bajanam
changed the title
[FR] Add Ability to deserialize String to ObjectId and i64 to DateTime
RUST-1540 [FR] Add Ability to deserialize String to ObjectId and i64 to DateTime
Nov 8, 2022
bajanam
changed the title
RUST-1540 [FR] Add Ability to deserialize String to ObjectId and i64 to DateTime
RUST-1540 Add Ability to deserialize String to ObjectId and i64 to DateTime
Nov 8, 2022
Uh oh!
There was an error while loading. Please reload this page.
For some reasons I see
Bson
doesn't deserializeObjected
andDateTime
toString
andi64
respectively, so I think it'd be very helpful if there's an inbuilt helper fn to use with serde'sdeserialize_with
macro attribute to automatically deserializeObjectId
toString
andDateTime
toi64
..Example
then we'll be able to do something like this
This is very useful for returning
ObjectId
as String and DateTime as i64instead of something like this
The text was updated successfully, but these errors were encountered: