[SERVER-62492] $geoWithin shouldn't accept multiple shapes Created: 10/Jan/22  Updated: 29/Oct/23  Resolved: 01/Sep/22

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

Type: Bug 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:
Related
related to SERVER-62481 $_internalBucketGeoWithin parser is n... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

The $geoWithin parser accepts multiple shapes (things like $center, $centerSphere, $geometry), but it ignores all but the last one.

// Only $center is used:
> db.c.find({loc: {$geoWithin: {$centerSphere: [[0, 80], 1], $center: [[0, 0], 5]}}})
{ "_id" : ObjectId("61dca5b1ef27df133baf5abd"), "loc" : [ 0, 0 ] }
 
// Only $centerSphere is used:
> db.c.find({loc: {$geoWithin: {$center: [[0, 0], 5], $centerSphere: [[0, 80], 1]}}})

This seems like a mistake. (If we really accepted multiple shapes, a more useful behavior would be union or intersection.) And the docs examples all use a single shape: https://docs.mongodb.com/manual/reference/operator/query/geoWithin/

We should consider fixing $_internalBucketGeoWithin in the same way.



 Comments   
Comment by Githook User [ 01/Sep/22 ]

Author:

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

Message: SERVER-62492 $geoWithin shouldn't accept multiple shapes
Branch: master
https://github.com/mongodb/mongo/commit/d683e42c67a5a75b7ba16491e2b168bcb6a286ce

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