From d43ce48dbf4e1502f850f66b3f7682fe535e2810 Mon Sep 17 00:00:00 2001 From: Liam Morley Date: Fri, 14 Nov 2014 19:55:47 -0800 Subject: [PATCH] update to work with Mongo 2.6 see http://docs.mongodb.org/master/release-notes/2.6-compatibility/#maxdistance-changes --- files/README.txt | 2 +- lib/routes/search.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/files/README.txt b/files/README.txt index 7bf1a66..615585f 100644 --- a/files/README.txt +++ b/files/README.txt @@ -21,4 +21,4 @@ To ensure geo indexes on location fields run: (this should be a one time operation after creating the db) To query for all locations within 10000000 meters of <40,-71>, ordered by proximity run: - db.pantries.find({"loc":{ $near:{$geometry:{type:"Point",coordinates:[-71.0,40.0]}}, $maxDistance:10000000}}) + db.pantries.find({"loc":{ $near:{$geometry:{type:"Point",coordinates:[-71.0,40.0]}, $maxDistance:10000000}}}) diff --git a/lib/routes/search.js b/lib/routes/search.js index f9dee8e..7fe1191 100644 --- a/lib/routes/search.js +++ b/lib/routes/search.js @@ -14,7 +14,7 @@ module.exports = function(app) { var search = function(lat, lng, radius) { radius || (radius = Infinity); // default radius of Infinity to include everything - Pantry.find({loc: {$near: {$geometry: {type: "Point", coordinates: [lng,lat]}}, $maxDistance: radius}}, function(err, pantries) { + Pantry.find({loc: {$near: {$geometry: {type: "Point", coordinates: [lng,lat]}, $maxDistance: radius}}}, function(err, pantries) { if (err != null || pantries == null) { console.log("unable to find results", err, pantries); res.send('unable to find any pantries', 404); @@ -46,4 +46,3 @@ module.exports = function(app) { }); } -