node.js - How can I get distance using geoSearch in Mongoose -



node.js - How can I get distance using geoSearch in Mongoose -

i succeed in using geonear() shops distance;

i successed in using geosearch() shops in special type without showing me distance.

how can list shops in special type showing me distance?

model.geonear({ "type": "point", "coordinates": opts.coordinates }, { lean: true, spherical: true, includelocs: true, maxdistance: opts.radius / earth_radius, distancemultiplier: earth_radius }, function(err, shops, stats) { var results = exports.trimeddistance(shops); deferred.resolve(results); });

--

model.geosearch({ _category: mongoose.types.objectid(opts.categoryid) }, { near: opts.coordinates, lean: true, limit: 10, maxdistance: opts.radius / earth_radius }, function(err, shops) { var results = exports.trimeddistance(shops); deferred.resolve(results); });

resolved.

using geonear aggregate http://docs.mongodb.org/manual/reference/operator/aggregation/geonear/

node.js mongodb mongoose

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -