Estou usando o comando abaixo,
db.alunos.aggregate([{ "$geoNear":{ "near": { "coordinates":[-23.588055, -46.632403], "type":"Point" }, "distanceField": "distancia.calculada", "spherical": true, "num":4 } }])
e estou recebendo o seguinte erro,
2019-04-03T10:21:23.661-0300 E QUERY [js] uncaught exception: Error: command failed: { "ok" : 0, "errmsg" : "$geoNear no longer supports the 'num' parameter. Use a $limit stage instead.", "code" : 50857, "codeName" : "Location50857" } : aggregate failed : getErrorWithCode@src/mongo/shell/utils.js:25:13 doassert@src/mongo/shell/assert.js:18:14 _assertCommandWorked@src/mongo/shell/assert.js:584:17 assert.commandWorked@src/mongo/shell/assert.js:674:16 DB.prototype.runAggregate@src/mongo/shell/db.js:260:9 DBCollection.prototype.aggregate@src/mongo/shell/collection.js:992:12 @(shell):1:1
Não estou conseguindo limitar a geolocalização pode ajudar?