node.js - Aggregate works in command line but not with mongoose -


i trying find out why aggregate command works in mongodb not in mongoose:

db.providers.aggregate({$geonear{near[-117.67625427246094,33.58256912231445], distancefield: "dist",  spherical: true, maxdistance: 71591.87002706563, query{type_id:1}}}).pretty(); 

the following returns single row:

"provider_id" : 1366826512, "providername" : "dover xxxx", "loc" : {     "type" : "point",     "coordinates" : [         -117.9081489,         33.6195128     ] }, "dist" : 0.003432172265332921 

but same command not return mongoose.

provider.aggregate([         {              $geonear: {                  near: { type: "point", coordinates: [parsefloat(platlngarray[0]), parsefloat(platlngarray[1])] },                  distancefield: "dist",                 spherical: true,                  //distancemultiplier: 3963.2,                 maxdistance: parsefloat(pradius),                 query: { type_id: ptype },             }          }         ],         function(err, result){                       if (err) {             console.log("error: providermodel::listproviders: ", err);             return callback([]);         }         console.log(json.stringify(result));                   return callback(result);     }); 

can tell me doing wrong?

thanks in advance.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -