- I queried a collection of coordinates within a region and found that when the range was particularly large (> 300km), I looked up some coordinates outside the range. Is this because the radius error is too large, or is there something wrong with the code I wrote? When this range is smaller, it is found that the query results are normal.
Bson bson = Filters.geoWithinCenterSphere("loc" , 110.29239, 30.2323, 120 / 6371000); // 1206371000
FindIterable findIterable = mongoTemplate.getCollection("test" ).find(bson);
I use the command to query
db.places.find( { loc :
{ $geoWithin :
{ $geometry :
{ type : "Polygon",
coordinates : [ [
[ 151.53203354373443 , 58.49758352997918 ] ,
[ 151.53203354373443 , 58.60891434369525] ,
[ 157.98703167431324 , 58.60891434369525 ] ,
[ 157.98703167431324 , 58.49758352997918 ],
[151.53203354373443 , 58.49758352997918]
] ]
} } } } )
it is found that there are individual longitudes and latitudes in the result list that are not within this area. For example: 156.1194, 58.638217, this coordinate.
do not understand that my query method is wrong? Or is it caused by errors in mongodb region queries?