I am using MongoDBCompass to execute the following query:
{t: {'$gte':new ISODate((Date().getTime()-10000))}}
This works fine to get all data points that have t in the last 10 seconds, but only from the first time that I execute the command in the command line of Compass.
From there on, the timestamp does not refresh and remains the same as the first calculated value. Thus, when I repetitively execute the query, I get more and more points.
For instance, at the first query, the timestamp is computed as:
2022-01-28 11:00:00
While currently it is:
2022-01-28 11:00:10
I have 5 second sampled points, so this query will return two points:
2022-01-28 11:00:00
2022-01-28 11:00:05
Then, if I execute the query five seconds later, it returns three points:
2022-01-28 11:00:00
2022-01-28 11:00:05
2022-01-28 11:00:10
Instead of only two points:
2022-01-28 11:00:05
2022-01-28 11:00:10
And so on...
I can see from the recent queries tab on the rhs of the program, that the timestamp does not refresh. How can I write the query, such that the timestamp is recomputed every time that I execute the command?
Thanks!