MongoDB-Mongoose Aggregation with geoNear and query parameter, using _id -


i'm trying code working. have select people based on distance, array of _ids have.

i'm trying do:

volunteer.aggregate(     [       {         "$geonear": {             "near": {                 "type": "point",                 "coordinates": [7.6852228, 45.0714124]             },             "distancefield": "distance",             "maxdistance": 1000,             "spherical": true,             "query": { _id: "5597f359bc2683902b3ba7b2" }             /*"query": {                  "_id": { "$in" : ["5597f359bc2683902b3ba7b2"] }             }*/           }       }, {           "$sort": {           "distance": -1           }       } // sort nearest first     ],       function(err, docs) {         if(err){           res.jsonfail(err);         }else{           res.jsonsuccess(docs);         }       }   ); 

if pass, field of query parameter, _id, 0 result.

if comment out, or search field (firstname example), show me results.

anyone faced issue?


Comments