how to use geoNear in nodejs?
问题 I want to use geospatial geoNear, database in mongodb, Mongo Query: db.runCommand( { geoNear: "tmp", near: { type: "Point", coordinates: [ 77.00000, 12.00000] }, spherical: true, maxDistance : 200 } ) Gives result in mongo terminal, but how to execute it using node.js I am using mongo-pool and generic-pool for mongo pooling? 回答1: Use the $geoNear operator for the aggregation pipeline (available if you are using MongoDB 2.4 or greater). For example: var mongodb = require('mongodb') ,