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

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -