-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: 3.4.0
-
Component/s: Querying
-
None
-
Query
There seems to be no way to retrieve the system date of the mongodb server. This is a problem if the client time is not synched with the server (which it will usually not be). Currently the only option is to use a new Date() from either javascript on the client or the language of the driver, or possibly using a $where.
This could easily be solved by allowing $currentDate to be used in queries rather than just in updates.
The problem with not having this is, for example, on a findAndModify when a Date or Timestamp value is part of the query. It would be best to have the corresponding date field be from a uniform base, such as what $currentDate is, namely the system time of the server. Consider when querying against an expiration time, it is somewhat useless from multiple servers, with only gross time intervals making sense.
- duplicates
-
SERVER-23656 Current timestamp variable for aggregate expressions
- Closed