|
Hi huyingming,
Thank you for the detailed report. This issue has been corrected by SERVER-27822 and will be included in MongoDB 3.6. See below for an example of the output run against our latest development release:
(3.5.13) > db.foo.explain("executionStats").count({"keyword":/a/i})
|
{
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "db1.foo",
|
"indexFilterSet" : false,
|
"parsedQuery" : {
|
"keyword" : {
|
"$regex" : "a",
|
"$options" : "i"
|
}
|
},
|
"winningPlan" : {
|
"stage" : "COUNT",
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"filter" : {
|
"keyword" : {
|
"$regex" : "a",
|
"$options" : "i"
|
}
|
},
|
"keyPattern" : {
|
"keyword" : 1
|
},
|
"indexName" : "keyword_1",
|
"isMultiKey" : false,
|
"multiKeyPaths" : {
|
"keyword" : [ ]
|
},
|
"isUnique" : false,
|
"isSparse" : false,
|
"isPartial" : false,
|
"indexVersion" : 2,
|
"direction" : "forward",
|
"indexBounds" : {
|
"keyword" : [
|
"[\"\", {})",
|
"[/a/i, /a/i]"
|
]
|
}
|
}
|
},
|
"rejectedPlans" : [ ]
|
},
|
"executionStats" : {
|
"executionSuccess" : true,
|
"nReturned" : 0,
|
"executionTimeMillis" : 0,
|
"totalKeysExamined" : 2,
|
"totalDocsExamined" : 0,
|
"executionStages" : {
|
"stage" : "COUNT",
|
"nReturned" : 0,
|
"executionTimeMillisEstimate" : 0,
|
"works" : 3,
|
"advanced" : 0,
|
"needTime" : 2,
|
"needYield" : 0,
|
"saveState" : 0,
|
"restoreState" : 0,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"nCounted" : 2,
|
"nSkipped" : 0,
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"filter" : {
|
"keyword" : {
|
"$regex" : "a",
|
"$options" : "i"
|
}
|
},
|
"nReturned" : 2,
|
"executionTimeMillisEstimate" : 0,
|
"works" : 3,
|
"advanced" : 2,
|
"needTime" : 0,
|
"needYield" : 0,
|
"saveState" : 0,
|
"restoreState" : 0,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"keyPattern" : {
|
"keyword" : 1
|
},
|
"indexName" : "keyword_1",
|
"isMultiKey" : false,
|
"multiKeyPaths" : {
|
"keyword" : [ ]
|
},
|
"isUnique" : false,
|
"isSparse" : false,
|
"isPartial" : false,
|
"indexVersion" : 2,
|
"direction" : "forward",
|
"indexBounds" : {
|
"keyword" : [
|
"[\"\", {})",
|
"[/a/i, /a/i]"
|
]
|
},
|
"keysExamined" : 2,
|
"seeks" : 1,
|
"dupsTested" : 0,
|
"dupsDropped" : 0,
|
"seenInvalidated" : 0
|
}
|
}
|
}
|
}
|
Kind regards,
Kelsey
|
|
Note that this case was fixed for 3.5.9 (see below on 3.5.9) likely as part of SERVER-27822. This example was not quite the same as SERVER-29967 as that one only applies to doing filtering on FETCH when an index is multikey" and this index isn't multikey.
(3.5.13) > db.foo.explain("executionStats").count({"keyword":/a/i})
|
{
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "db1.foo",
|
"indexFilterSet" : false,
|
"parsedQuery" : {
|
"keyword" : {
|
"$regex" : "a",
|
"$options" : "i"
|
}
|
},
|
"winningPlan" : {
|
"stage" : "COUNT",
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"filter" : {
|
"keyword" : {
|
"$regex" : "a",
|
"$options" : "i"
|
}
|
},
|
"keyPattern" : {
|
"keyword" : 1
|
},
|
"indexName" : "keyword_1",
|
"isMultiKey" : false,
|
"multiKeyPaths" : {
|
"keyword" : [ ]
|
},
|
"isUnique" : false,
|
"isSparse" : false,
|
"isPartial" : false,
|
"indexVersion" : 2,
|
"direction" : "forward",
|
"indexBounds" : {
|
"keyword" : [
|
"[\"\", {})",
|
"[/a/i, /a/i]"
|
]
|
}
|
}
|
},
|
"rejectedPlans" : [ ]
|
},
|
"executionStats" : {
|
"executionSuccess" : true,
|
"nReturned" : 0,
|
"executionTimeMillis" : 0,
|
"totalKeysExamined" : 2,
|
"totalDocsExamined" : 0,
|
"executionStages" : {
|
"stage" : "COUNT",
|
"nReturned" : 0,
|
"executionTimeMillisEstimate" : 0,
|
"works" : 3,
|
"advanced" : 0,
|
"needTime" : 2,
|
"needYield" : 0,
|
"saveState" : 0,
|
"restoreState" : 0,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"nCounted" : 2,
|
"nSkipped" : 0,
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"filter" : {
|
"keyword" : {
|
"$regex" : "a",
|
"$options" : "i"
|
}
|
},
|
"nReturned" : 2,
|
"executionTimeMillisEstimate" : 0,
|
"works" : 3,
|
"advanced" : 2,
|
"needTime" : 0,
|
"needYield" : 0,
|
"saveState" : 0,
|
"restoreState" : 0,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"keyPattern" : {
|
"keyword" : 1
|
},
|
"indexName" : "keyword_1",
|
"isMultiKey" : false,
|
"multiKeyPaths" : {
|
"keyword" : [ ]
|
},
|
"isUnique" : false,
|
"isSparse" : false,
|
"isPartial" : false,
|
"indexVersion" : 2,
|
"direction" : "forward",
|
"indexBounds" : {
|
"keyword" : [
|
"[\"\", {})",
|
"[/a/i, /a/i]"
|
]
|
},
|
"keysExamined" : 2,
|
"seeks" : 1,
|
"dupsTested" : 0,
|
"dupsDropped" : 0,
|
"seenInvalidated" : 0
|
}
|
}
|
},
|
"serverInfo" : {
|
"host" : "Asyas-MacBook-Pro.local",
|
"port" : 27017,
|
"version" : "3.5.13",
|
"gitVersion" : "52bbaa007cd84631d6da811d9a05b59f2dfad4f3"
|
},
|
"ok" : 1
|
}
|
|