Manish Kashyap
My feedback
1 result found
-
9 votes
An error occurred while saving the comment Manish Kashyap supported this idea ·
1 result found
Please sign in to leave feedback
Please sign in to leave feedback
No results.
Clear search results
As per the link below these are stored with millisecond precision
https://www.mongodb.com/docs/manual/reference/bson-types/#std-label-document-bson-type-date
BSON Date is a 64-bit integer that represents the number of milliseconds since the Unix epoch (Jan 1, 1970). This results in a representable date range of about 290 million years into the past and future.
However for java.time.LocalDateTime , it is stored to nano second precision.
https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html
Time is represented to nanosecond precision. For example, the value "2nd October 2007 at 13:45.30.123456789" can be stored in a LocalDateTime.
Therefore we are not able to store the LocalDateTime as BSON Date type in Mongo and therefore we can not query using the LocalDateTime.
The current workaround which we currently doing is to store them as String and deserialising them as LocalDateTime, however we can not query using the LocalDateTime.