I'm writing a pipeline for a mongoose query which requires matching dates with the current date. I could use "new Date()" to obtain the new date but the pipeline is created once at server start. How can I write a statement which evaluates to the date of execution of the query? Maybe the date can be computed by mongodb itself?
Try using $currentDate
operator, in your pipeline.