Is there a way to search multiple ranges for collections in mongo database?. I have tried the following but doesn't work although it works for a single range
db.collection(collection)
.aggregate([
{
$search: {
compound: {
filter: [
{
range: {
path: createdAt,
gte: startdate,
lte: endDate,
},
},
{
range: {
path: updatedAt,
gte: startdate,
lte: endDate,
},
},
],
},
},
},
{
$limit:20,
},
])
.toArray()