mongodb: can't get query executor when executing geoNear aggregate -


when executing following aggregate

db.activities.aggregate([    {      $geonear: {         near: { coordinates: [ -73.99279 , 40.719296 ] },         distancefield: "location.calculated",         spherical: true,      }    } ]) 

i getting following error

uncaught exception: aggregate failed: {     "errmsg" : "exception: geonear command failed: { ok: 0.0, errmsg: \"can't query executor\" }",     "code" : 16604,     "ok" : 0 } 

when run geonear command, works fine.

db.runcommand( {    geonear: "activities" ,    near: [ -73.99279 , 40.719296 ],    spherical: true, }) 

any ideas doing worng ?

the problems be:

  1. you missing "2dsphere" index in collection activities.
  2. there multiple geo indexes in collection activities

run code in mongo shell see indexes

db.activities.getindexes() 

Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -