Skip to content

Commit

Permalink
update to work with Mongo 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam Morley committed Nov 15, 2014
1 parent 4756456 commit d43ce48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion files/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}}})
3 changes: 1 addition & 2 deletions lib/routes/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -46,4 +46,3 @@ module.exports = function(app) {
});

}

0 comments on commit d43ce48

Please sign in to comment.