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

Create an internal, bucketed $geoWithin operator

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Query Optimization 2021-07-26, Query Optimization 2021-08-09, QO 2021-08-23

      Currently when you use $geoWithin on a time-series collection, it can only be pushed down if the predicate is on a metadata field. We'd like to also push down geo predicates on measurements.

      But $geoWithin can't express this bucket-level predicate. We should introduce a new internal-only operator, say "$_internalBucketGeoWithin", that can discard buckets that definitely don't contain points in the given region.

      For example:

      {$_internalUnpackBucket: ...}
      {$match: {location: {$geoWithin: ...}}}
      

      could be optimized to something like:

      {$match: {$_internalBucketGeoWithin: {
        withinRegion: ...,
        field: "location",
        ...
      }}}
      {$_internalUnpackBucket: ...}
      {$match: {location: {$geoWithin: ...}}}
      

      The implementation could use control.min.location / control.max.location to quickly discard many buckets.

      This ticket is only about creating the new operator. Optimization and indexing will be separate.

            Assignee:
            ruoxin.xu@mongodb.com Ruoxin Xu
            Reporter:
            david.percy@mongodb.com David Percy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: