if I have these docs:
{"name": 1, "score": 2}
{"name": 1, "score": 4}
{"name": 2, "score": 2}
{"name": 2, "score": 4}
if I ensure the index:
db.test.ensureIndex({"name":1, "score":1})
then I try to find():
db.test.find({"score": 4})
I use explain(), and found that this query can not use the index and it scan all the four docs.
I wonder why it scans all the docs?
you know, if I enum all the "name" 's value (1 and 2):
db.test.find({"$or":["name":1, "name":2], "score":4})
it can use the index and only scanned two docs.
why mongodb can not do this thing for me?