How to make $geoIntersects work for the “legacy coordinates pair”?
it is simple to find the user’s current neighborhood with $geoIntersects.
Trying to make/adapt the following find by $geoIntersects work with the “legacy coordinates pair” – db.neighborhoods.findOne({ geometry: { $geoIntersects: { $geometry: { type: "Point", coordinates: [ -73.93414657, 40.82302903 ] } } } })
but I always get null results, even I surely know there is a match.
Suppose the user is located at -73.93414657 longitude and 40.82302903 latitude. To find the current neighborhood, you will specify a point using the special $geometry field in GeoJSON format.
I guess, on top of the above requirement, the field used for the $geoIntersects lookup must be in GeoJSON format as well, (unlike $geoWithin or $nearSphere), right?
So, if my collection uses the legacy coordinates pair, like the sample_restaurants from sample db, is there any way for me to use the $geometry query please?
Please double-check that you are running the query against the correct collection, and ensure that your collection contains the correct set of data for accurate results.