1 / 1
May 2024

Hi,

I have a query of format

{ $or: [ { {.....}, $and: [ {....}, {....}, { tags: { $elemMatch: { $or: [ { tag_id: "*****", }, ], }, }, } ] }, { similar as above } ], }

This query is not utilizing any index although present. There are 2 clauses in $or. When I remove any one of them index is used. Why is this case? I tried removing tag filter above and index is used even when there are 2 or more clauses.

Thanks for help