near field must be point near field must be point mongoose mongoose

near field must be point


The issue is with the coordinates which are always should be numeric whereas you put it as String

So instead convert them to integer or float value

Review.aggregate([{  "$geoNear": {    "near": {      "type": "Point",      "coordinates": [parseFloat(req.params.longitude), parseFloat(req.params.latitude)]    },    "spherical": true,    "maxDistance": 10 * 1609,    "distanceField": "distance"  }}])


Going to add to this one - the geocoords must also be valid, and the query is lng,lat - if you get them backwards or simply specify an invalid co-ordinate then you get the same error.