MongoDB query issue: ISODate().getTime() is not working in mongo web

Viewed 14

I'm facing the problem below:

Query: {date: {$lte: new Date(ISODate().getTime() - 1000 * 3600 * 24 * 3)}}

  1. The same query, executed error thru mongo Atlas web, but in compass, it's working.
  2. I'm trying to all get the data and exclude the data in past 2 days(include today).
  3. I'm using Mongo DB 5.0.
  4. Both of the query are connect to the same DB endpoint.

Image 1 I execute the query in mongo atlas web, and having error.

Image 2 Then I try run the same query in Compass, without any issue.

Any clue? Thanks in advance!

0 Answers
Related