Skip to content

Instantly share code, notes, and snippets.

@alexvenom
Created June 7, 2022 13:05
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 alexvenom/5b3db39d1b44dcdf123ad77616ffcd12 to your computer and use it in GitHub Desktop.
Save alexvenom/5b3db39d1b44dcdf123ad77616ffcd12 to your computer and use it in GitHub Desktop.
// User's location
const userLocation = myUser.get("location");
// Create a query for Restaurants
const query = new Parse.Query("Restaurant");
// Interested in locations near the User
query.near("location", userLocation);
// Limit the result set to 10 objects
query.limit(10);
// Final list of 10 Restaurants nearest to the User, ordered by Distance ascending
const nearRestaurants = await query.find();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment