Skip to content

Instantly share code, notes, and snippets.

@awatson1978
Created May 19, 2018 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awatson1978/052e7979e753cc7445062efe2172540f to your computer and use it in GitHub Desktop.
Save awatson1978/052e7979e753cc7445062efe2172540f to your computer and use it in GitHub Desktop.
$near
var user = Meteor.user();
var centroid = user.profile.locations.home;
var coordinatesArray = [centroid.longitude, centroid.latitude];
Locations.find({
location:
{ $near :
{
$geometry: { type: "Point", coordinates: coordinatesArray },
$minDistance: 1000,
$maxDistance: 5000
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment