-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 4.0.12
-
Component/s: None
-
None
-
ALL
When issuing a $geoWithin using a Polygon as the search region, GeoJSON Points near-ish to the region are unexpectedly included or excluded. Since the Polygon in question is actually rectangular, changing to use $geoWithin with a $box fixed the issue. Is this expected? Is there any suggested workaround other than using a box?
Here is a sample point and the Polygon-based find that incorrectly matches:
> db.coll.insertOne({"location": {"type": "Point", "coordinates": [11.84, 50.1588, 9433.56]}}) > db.coll.find({ ... "location": { ... "$geoWithin": { ... "$geometry": { ... "type": "Polygon", ... "coordinates": [ ... [ ... [ 0.849607, 43.447224], ... [23.23242, 43.447224], ... [23.23242, 49.873922], ... [ 0.849607, 49.873922], ... [ 0.849607, 43.447224] ... ] ... ] ... } ... } ... } ... })
This box-based find, however, works as expected:
> db.coll.find({"location": {"$geoWithin": {"$box": [[0.849607, 43.447224], [23.23242, 49.873922]]}}})
and does not match the document.
- is related to
-
SERVER-76728 $box that spans the Antemeridian doesn't work as expected
- Closed