I have a collection where I am keeping all the locations with lat and long. To find the records in 500m radius and 1000m radius is like following,
{
loc: {
$geoWithin: {
$centerSphere: [[lng, lat], (radiusInMiles / 3963.2)]
}
}
}
But, what if I have to find all the records between the two radiuses, like records between 500m and 1000m.
{
loc: {
$near: {
$geometry: {
type: "Point" ,
coordinates: [ <longitude> , <latitude> ]
},
$maxDistance: <distance in meters>,
$minDistance: <distance in meters>
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.