Consider a collection with an index {x: 1} consisting of the following documents:
[
{x : 5},
{x : 5},
{x : 5}
]
The explain output on the query predicate {x : 5} shows that the total keys examined = total documents examined = documents returned = 3.
This is not what I expected. I expected the total keys examined to equal 1 and total documents examined = total documents returned = 3. The reason for my expectation is because of how I understand how MongoDB treats documents with the same key value in the BTree; if multiple documents have the same key value, the node with that key will have a reference to all documents with the key value. In this case three documents have the same key value x = 5 so MongoDB should scan only this key and return all referenced documents.
Why is the key count = 3 and not 1, is there something am missing?