Quando eu tento rodar o comando, exatamente este que está na Ajuda
db.aluno.aggregate([{
$geoNear:{
"near": {
"coordinates":[-23.588055, -46.632403],
"type":"Point"
},
"distanceField": "distancia.calculada",
"spherical": true
}
}])
Gera este erro:
assert: command failed: {
"ok" : 0,
"errmsg" : "geoNear command failed: { waitedMS: 0, ok: 0.0, errmsg: \"can't find ns\" }",
"code" : 16604
} : aggregate failed
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:13:14
assert.commandWorked@src/mongo/shell/assert.js:287:5
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1312:5
@(shell):1:1
2016-10-08T00:12:46.167-0300 E QUERY [thread1] Error: command failed: {
"ok" : 0,
"errmsg" : "geoNear command failed: { waitedMS: 0, ok: 0.0, errmsg: \"can't find ns\" }",
"code" : 16604
} : aggregate failed :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:13:14
assert.commandWorked@src/mongo/shell/assert.js:287:5
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1312:5
@(shell):1:1
Não sei se estou deixando passar algo, ou falta instalar alguma dependência no meu MongoDB. (Tive que dar apt-get para o mongoimport funcionar antes.)