I have a date time field in the database that stores the time when a record was entered in the database. I am trying to fetch data entered after a certain date but system is not returning any results
I have already tried tried the
date: {$gt : "2020-11-22"}
and
date: {$gt : "2020-08-19T00:00:00.000+00:00"}
How do I make the query work? I cannot figure out what I am doing wrong
You can try something like following in the $match
stage
{
$expr:{
$gt:["$updateAt",new Date("2020-08-18")]
}
}
or you can use
{
updateAt:{
$gt : new Date("2020-08-19")
}
}