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
When deserialising to a Map or similar flexible type $date fields get deserialised as java.util.date
e.g: something like mongoTemplate.find(query, Map.class, "myCollection")
will convert:
{"time": {
"$date": "2024-10-18T16:32:51.058Z"
}}
returning a Date for the "time" field.
java.util.Date is an antiquated, broken and difficult to use class. Since timezone ('z') information is specified in the value the natural default conversion would be java.time.Instant. (or possibly a ZonedDateTime but this is possibly less convenient in the majority of cases)
In general all uses of java.util.Date and java.util.Calendar should be removed.
The text was updated successfully, but these errors were encountered:
When deserialising to a Map or similar flexible type $date fields get deserialised as java.util.date
e.g: something like
mongoTemplate.find(query, Map.class, "myCollection")
will convert:
returning a Date for the "time" field.
java.util.Date is an antiquated, broken and difficult to use class. Since timezone ('z') information is specified in the value the natural default conversion would be java.time.Instant. (or possibly a ZonedDateTime but this is possibly less convenient in the majority of cases)
In general all uses of java.util.Date and java.util.Calendar should be removed.
The text was updated successfully, but these errors were encountered: