Index used but keys & docs examined is 0 with docs returned is around 300

one of my aggregation query using match (a,b), graphlookup and unwind has explain output with index being used (idx_a_1_b_1) shows keys & docs examined is 0 with docs returned is around 300. So, my question is why does the docs and keys examined are 0 event though documents are returned?

Hi @Sateesh_Bammidi welcome to the community!

This is very hard to determine without actual examples, do you mind posting:

Best regards
Kevin

I also have same question.

When I refer log for queries executed, it shows log records with 0 keysExamined as well as 0 docsExamined, but nReturned is non-zero number. All these queries have “getMore” as command.

Sample log record is shown below:

{ "_id" : ObjectId("64f60cda03c66e64ab567374"), "t" : ISODate("2023-03-19T04:31:28.490Z"), "s" : "I", "c" : "COMMAND", "id" : 51803, "ctx" : "conn59", "msg" : "Slow query", "attr" : { "type" : "command", "ns" : "LE.L", "command" : { "getMore" : NumberLong("39043538923983074"), "collection" : "L", "lsid" : { "id" : UUID("8cd9cc5b-e51c-425f-aeca-ca0b60ce43ad") }, "$db" : "LE" }, "originatingCommand" : { "aggregate" : "L", "pipeline" : [ { "$match" : { "rs" : { "$elemMatch" : { "rfield" : { "$gte" : 30001, "$lte" : 70000 } } } } }, { "$unwind" : "$rs" }, { "$match" : { "rs.rfield" : { "$gte" : 30001, "$lte" : 70000 } } }, { "$group" : { "_id" : "$rs.rid", "rfield" : { "$first" : "$rs.rfield" } } } ], "cursor" : {  }, "lsid" : { "id" : UUID("8cd9cc5b-e51c-425f-aeca-ca0b60ce43ad") }, "$db" : "LE" }, "planSummary" : "IXSCAN { rs.rfield: 1 }", "cursorid" : NumberLong("39043538923983074"), "keysExamined" : 0, "docsExamined" : 0, "cursorExhausted" : true, "numYields" : 0, "nreturned" : 80171, "reslen" : 2634625, "locks" : {  }, "remote" : "10.1.3.163:55496", "protocol" : "op_msg", "durationMillis" : 44 } }

Does it mean no keys or docs examined during getMore operation? But, all keys and docsExamined during previous query execution?

Please see