mongodb, sorting by geoNear and date?
问题 how to sort by proximity and date in mongoDB? I tried this. But they just sort by date: coll.find({'date':{$gte:date},'location':{$nearSphere:[lat,lng]}}).sort({'date':1}).execFind(function (err, docs) {}) I appreciate the help. 回答1: There's no direct way to use $near or $nearSphere and sort by another field, because both of these operators already sort the results of doing a find() . When you sort again by 'date', you're re-sorting the results. What you can do, however, is grab results from