[SERVER-58359] More flexible query containment for $geoWithin Created: 07/Jul/21  Updated: 29/Oct/23  Resolved: 28/Jul/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: New Feature Priority: Major - P3
Reporter: David Percy Assignee: Maddie Zechar
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-57763 Allow partial filter expression to us... Closed
Problem/Incident
causes SERVER-73242 Partial index with $geoWithin filter ... Backlog
Related
related to SERVER-73235 Replace invariant with uassert in geo... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query Optimization 2021-07-26, Query Optimization 2021-08-09
Participants:
Linked BF Score: 127

 Description   

When considering whether a $geoWithin partial index can be used to satisfy a query, currently we treat the $geoWithin opaquely, so only queries that explicitly mention that region can use the index. For example,

coll.createIndex({loc: '2dsphere'}, {partialFilterExpression: {loc: {$geoWithin: ... usa ... }}});
 
coll.find({loc: {$geoWithin: ... usa ... }});  // indexed
 
coll.find({$and: [                             // indexed
  {loc: {$geoWithin: ... usa ... }},  
  {loc: {$geoWithin: ... nyc ... }},
]});
 
coll.find({loc: {$geoWithin: ... nyc ... }});  // not indexed

The third query should be indexed, because nyc is geometrically contained in usa.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 28/Jul/21 ]

Author:

{'name': 'Maddie Zechar', 'email': 'mez2113@columbia.edu', 'username': 'madelinezec'}

Message: SERVER-58359: More flexible query containment for $geoWithin
Branch: master
https://github.com/mongodb/mongo/commit/f4e6aef833392c201b561eb9960d8b24176c885e

Comment by David Percy [ 08/Jul/21 ]

We should be able to use the implementation of $geoWithin, to check whether one region contains another. It eventually calls a library (S2), but there may be other checks that happen first. We can start by looking at GeoMatchExpression::matchesSingleElement.

Generated at Thu Feb 08 05:44:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.