I have 3 fields indexed in Atlas Search from a mongodb collection of documents:
- deleted
- duplicate
- publication_date
I am trying to query Atlas Search using the aggregate method and i need to filter out documents with deleted and duplicate set to true and at the same time bring only documents that have publication date with a range i specify.
I tried doing this:
{
compound:{
filter:[{
equals:{
value:false,
path:"deleted"
},
equals:{
value:false,
path:"duplicate"
}
}
]
},
range:{
path:'publication_date',
gte:ISODate("2021-04-01T00:00:00Z"),
lte:ISODate("2021-10-11T19:11:16.1928297Z")
}
}
But i get an error that i cant use compound and range together. I need to use compound because, i need to more must and must not criteria.
Both of them are working separately, but i need a way to combine them.
Any help is appreciated.