enter image description heredata range between dispatch time to disposal time
I’m tried await Product.find({ $and: [ { disposalTime:{ $lte:new Date().toISOString()} }, { dispatchTime: { $gte:new Date().toISOString()} } ]})
>Solution :
Compare with $$NOW in a $expr
db.collection.find({
$expr: {
$and: [
{
$lte: [
"$disposalTime",
"$$NOW"
]
},
{
$gte: [
"$dispatchTime",
"$$NOW"
]
}
]
}
})