-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
-
ALL
-
-
QI 2024-11-11, QI 2024-11-25, QI 2024-12-09
When testing the Query Settings mechanism on time series collections, I have noticed that some queries cannot be fully answered by indexes, while the same query on a normal collection can. One example is the following $lookup command, where both collections are time series collections:
pipeline: [ { $match: { a: 1, b: 5 } }, { $lookup: { from: secondaryColl.getName(), localField: "a", foreignField: "a", as: "output" } } ];
The $lookup stage results into sub-query, with the following Canonical Query:
[j0:prim] ns=test.system.buckets.secondaryTree: $or [j0:prim] $and [j0:prim] control.max.a $_internalExprGte 1.0 [j0:prim] control.min.a $_internalExprLte 1.0 [j0:prim] $expr {$ne: [{$type: ["$control.min.a"]}, {$type: ["$control.max.a"]}]} [j0:prim] Sort: {} [j0:prim] Proj: {} [j0:prim] Collation: { locale: "simple" }
given the following query settings:
{ indexHints: [ { ns: { db: "test", coll: "secondary" }, allowedIndexes: [ { a: 1.0 } ] } ] }
The interesting part is the the first branch of the $or condition can be fully answered using indexes, but the second can't, which seems to be added only for time series collections: $expr {$ne: [{$type: ["$control.min.a"]}, {$type: ["$control.max.a"]}]}
As this issue was blocking my ticket SERVER-86996, I've left some comments which should be fixed by this ticket.
These issue occur when running the `jstests/core/query/query_settings/query_settings_index_application_aggregate.js` test with the `timeseries_crud_jscore_passthrough` suite.