Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-78511

Disallow $_internalBucketGeoWithin in $elemMatch

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0-rc0
    • 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:

      1. A user would not write this directly: $_internalBucketGeoWithin is an internal expression for time-series.
      2. We wouldn't generate this internally, because we don't push down $elemMatch on events (if I remember correctly).
      3. $_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.

            Assignee:
            david.percy@mongodb.com David Percy
            Reporter:
            david.percy@mongodb.com David Percy
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: