0

I have a field called file_date, and in the start of the query I've set a new field called start_date which is 10 days back using:

{ $set: { start_date:{ $subtract: [ "$$NOW", 10*24*60*60*1000 ] } } }.

I want to use $match to find all the results where file_date is bigger then start_date.

I've tried using $gte but I can't seem to get the right syntax.

I'm using mongo 4.2 so I cant use SubstructDate

Thanks for any help

Changing the dates to strings using $toString. using $gte

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 2
    Does this answer your question? [MongoDb query condition on comparing 2 fields](https://stackoverflow.com/questions/4442453/mongodb-query-condition-on-comparing-2-fields) – ray Nov 22 '22 at 15:05

0 Answers0