I am getting an error when I try to use a gte with a date, in a find. What am I doing wrong?
I am trying to find records in the last 7 days.
db.XXXX.find({"lastSaved":{$gte: new Date(new Date() - 7 * 60 * 60 * 24 * 1000)}}).sort({"lastSaved" : -1})
syntax error near unexpected token `{“lastSaved”:{$gte:’
steevej
(Steeve Juneau)
2
This query is not generating an error message on my system.
Please provide a screenshot of where and how you issue this query that shows the error message you are getting.
I just realized I had exited the mongo shell and was in bash, without realizing it.
The query works.
2 Likes
system
(system)
Closed
4
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.