I am trying to get the results based on geospatial query of mongodb within a circle of 5 km radius of a given lat,long.
For that i am using this query
{coords :
{ $nearSphere :{
$geometry: {
type : "Point",
coordinates : [ data.longitude, data.latitude]
},
$maxDistance: 5000
}
}
}
But it is giving me undefined output. But when i remove the $maxDistance it is giving me all the results. I want to get the results only under the specified maxDistance.