mongodb - Covered queries and find all (no filter) -
i not sure if possible, i'm curious. have region collection purpose of being loaded web dropdown. not big thing there.
{ _id:"some numeric id", name:"region name", } and having index created db.regions.createindex({name:1})
i tried both db.regions.find({},{_id:0}).sort(name:1) , without sort. using explain shows totaldocsexamined greater zero, means not covered query if understood concept.
for covered query, have explicitly list each of covered fields in projection:
db.regions.find({}, {_id:0, name: 1}).sort(name:1) if exclude _id, you're telling mongodb include all fields besides _id. know docs have name field, mongodb doesn't have explicit.
Comments
Post a Comment