Problem Statement/Rationale
Compass should behave consistently with other tools such as mongosh, Charts and Node with respect to date helpers. Inconsistency leads to customer confusion and bugs (see this Slack discussion for an example)
Steps to Reproduce
- Find a collection with a date field.
- Use Compass to filter the data using something like this:
{ createDate: { $gt: Date("2001-01-01") }}
Expected Results
- Zero documents returned.
- This is because as per JavaScript oddities, Date("...") returns the current date as a string, ignoring the arguments.
- To get a working date filter, users would need to specify new Date("...") or new ISODate("...") or ISODate("...")
Actual Results
- Data is filtered based on the specified date, even though this is not how Javascript works.
Additional Notes
Any additional information that may be useful to include.