Last active
December 4, 2019 19:52
-
-
Save itsabdessalam/10c916f8089673e18ed27c5cdae0599d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StoreSchema.statics.findByCoordinates = function(coordinates, maxDistance) { | |
return this.aggregate([ | |
{ | |
$geoNear: { | |
near: { | |
type: "Point", | |
coordinates: coordinates | |
}, | |
maxDistance: maxDistance, | |
distanceField: "dist.calculated", | |
spherical: true | |
} | |
} | |
]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment