-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.0.5
-
Component/s: None
-
None
I have a problem with indexes on subdocuments where indexOnly is always false.
Take this code for example from the Mongo Docs (altered a bit to resemble my problem):
db.factories.insert( { name: "xyz", metro:
{ city: "New York", state: "NY" } } );
db.factories.ensureIndex(
);
db.factories.find(
, {_id:0, "metro.city" : 1} ).explain();
Output:
{
"cursor" : "BtreeCursor metro.city_1",
"nscanned" : 1,
"nscannedObjects" : 1,
"n" : 1,
"millis" : 0,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" :
}
Notice the indexOnly is false although an index is used and only indexed values should be returned. Hence the {_id:0, "metro.city" : 1} part.
Is this because the more than just the metro.city is returned? { "metro" :
}
Anybody any idea how I can make sure indexOnly becomes true in this situation?
- duplicates
-
SERVER-2104 covered index should support dotted fields
- Closed