-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
Fully Compatible
-
ALL
-
QO 2023-07-24, QO 2023-08-07, QO 2023-08-21, QO 2023-09-04, QO 2023-09-18, QO 2023-10-02, QO 2023-10-16
When parsing a MatchExpression, we should raise a user error if we find $_internalBucketGeoWithin anywhere inside an $elemMatch.
For example, this should be a parse error:
db.foo.find({abc: {$elemMatch: {$_internalBucketGeoWithin: {field: "xyz", withinRegion: {$centerSphere: [[0, 0], 10]}}}}})
This should be an error because:
- A user would not write this directly: $_internalBucketGeoWithin is an internal expression for time-series.
- We wouldn't generate this internally, because we don't push down $elemMatch on events (if I remember correctly).
- $_internalBucketGeoWithin assumes that its matches() method runs on the entire document, so it wouldn't behave correctly inside $elemMatch anyway.
- One reason it expects to be given the entire document, is that it can read from the bucket's control field. It can use the min/max values to create a bounding region.