Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
4.0.12
-
None
-
None
-
ALL
Description
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.
Attachments
Issue Links
- is related to
-
SERVER-76728 $box that spans the Antemeridian doesn't work as expected
-
- Closed
-