-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.8.2
-
Component/s: None
-
Labels:None
-
Environment:centos x64, mongo-10gen-server-1.8.2-mongodb_1 rpm
-
Linux
> db.index.find(
{ subdomain: "sub.domain.com"},
{ __id:1} ).explain();
{
"cursor" : "BtreeCursor subdomain_1_folder_1_name_1",
"nscanned" : 2002,
"nscannedObjects" : 2002,
"n" : 2002,
"millis" : 6,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" : {
"subdomain" : [
[
"sub.domain.com",
"sub.domain.com"
]
],
"folder" : [
[
,
{ "$maxElement" : 1 } ]
],
"name" : [
[
,
{ "$maxElement" : 1 } ]
]
}
}
> db.index.find(
{ subdomain: "sub.domain.org", folder: "" },
{subdomain:1} ).explain();
{
"cursor" : "BtreeCursor subdomain_1_folder_1_name_1",
"nscanned" : 1583,
"nscannedObjects" : 1583,
"n" : 1583,
"millis" : 9,
"nYields" : 2,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" : {
"subdomain" : [
[
"sub.domain.org",
"sub.domain.org"
]
],
"folder" : [
[
"",
""
]
],
"name" : [
[
,
{ "$maxElement" : 1 } ]
]
}
}
mongo returns __id in both queries anyway, does that mean mongod needs to scan for objectid in objects and uses some other reference in indexes? i'm confused - it shouldn't touch objects at all for queries like this.