I want to search for the document with my location, depending on whether I am within the polygon.
I have a document like this
{
...
"points": {
"coordinates": [
[
[
-3.679053009144624,
43.33304047030704
],
[
-9.294330256519363,
44.813402382628816
],
[
-7.0349117492277395,
44.3268008169113
],
[
-3.679053009144624,
43.33304047030704
]
]
],
"type": "Polygon"
},
...
}
My query
db.locations.find({
points: {
$geoIntersects: {
$geometry: {
type: "Point",
coordinates: [-6.6694316716305755, 44.15774788994904]
}
}
}
})
But it doesn’t return any results
point inside polygon
I have the 2dsphere index, but it still doesn’t work