Closed kingsanu closed 3 days ago
mongo server doesn't support equality comparison on just the date component of a stored utc isodate. so have to do a range query something like the following:
var results = await DB.Find<MyDocument>()
.Match(doc => doc.MyDate >= startOfDay && doc.MyDate < endOfDay)
.ExecuteAsync();
great thank you but is there any option that date always store in localtimezone, it make more problem with isodate, i saved 27 aug but it return 26 aug, and i can't parse always ToLocalTime()
in short ICreatedOn or any datetime stored in isodate i tried to store by ToLocalTime() but still return me isodate
that is the default behavior of the mongodb server and the official driver and not something related to this library. besides, the best approach to future proof your app is to store dates in utc and convert to and from required time zones with your app code. most of the time, i use the nodatime library.
i trying to filter only date except time, but it return me 0