Consider a collection
{ "_id" : { "a" : 1, "b" : 1 }, "c" : 1 }
{ "_id" : { "a" : 2, "b" : 3 }, "c" : 4 }
{ "_id" : { "a" : 3, "b" : 4 }, "c" : 5 }
{ "_id" : { "a" : 4, "b" : 5 }, "c" : 6 }
{ "_id" : { "a" : 5, "b" : 6 }, "c" : 7 }
{ "_id" : { "a" : 1, "b" : 5 }, "c" : 6 }
{ "_id" : { "a" : 1, "b" : -5 }, "c" : 6 }
in such a collection when you issue a query like
db.second.find({ "_id.a" : 1}).explain("executionStats")
The results indicate that it does a full collection scan. Is there a reason why it does not use any index ? It seems like a composite _id does not have a compound index ? Is there a reason why not ?