-
Type:
Improvement
-
Resolution: Won't Do
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The time field is required to be present and be of type Date. Comparisons on the time field that use non-Date types for the constant would be either trivially false (e.g. in the case of type-bracketing) or trivially true (in some cases without type-bracketing).
Currently, we don't optimize such comparisons out and always create $_internalUnpackBucket stage with an eventFilter:
> db.ts.explain().find({t: 42}) // "t" is the timeField in this collection
{
"explainVersion" : "1",
"stages" : [
{
"$cursor" : {
"queryPlanner" : {
"namespace" : "my.system.buckets.ts",
"indexFilterSet" : false,
"parsedQuery" : {
},
"queryHash" : "FCBE9F38",
"planCacheKey" : "64E90EFC",
"maxIndexedOrSolutionsReached" : false,
"maxIndexedAndSolutionsReached" : false,
"maxScansToExplodeReached" : false,
"winningPlan" : {
"stage" : "COLLSCAN",
"direction" : "forward"
},
"rejectedPlans" : [ ]
}
}
},
{
"$_internalUnpackBucket" : {
"exclude" : [ ],
"timeField" : "t",
"metaField" : "m",
"bucketMaxSpanSeconds" : 3600,
"assumeNoMixedSchemaData" : true,
"eventFilter" : {
"t" : {
"$eq" : 42
}
}
}
}
],
- related to
-
SERVER-86196 Complete TODO listed in SERVER-84207
-
- Closed
-