Below is the query that I'm using.
{
$match: {
$or: [
{ a: 1, b: 'P', c: null },
{ a: 1, b: 'R', c: 'P' },
{ a: 0, b: 'P', c: null },
{ a: 0, b: 'R', c: 'Q' },
],
},
}
Below is the index that I'm currently using
{
"a" : 1,
"b" : 1,
"c" : 1,
"createdAt" : 1
}
I've tried all indexes. I get below result when I do explain("ExecutionStats") even though I put limit(10), it examines all keys.
"executionStats" : {
"executionSuccess" : true,
"nReturned" : 27040,
"executionTimeMillis" : 3123,
"totalKeysExamined" : 27042,
"totalDocsExamined" : 53791,
}
I'm sorting on createdAt at the end of the query. I've also created an index on createdAt but still no success.