prescottprue / react-redux-firebase

Redux bindings for Firebase. Includes React Hooks and Higher Order Components.
https://react-redux-firebase.com
MIT License
2.55k stars 559 forks source link

Firestore query by geolocation #1009

Closed emersonlaurentino closed 3 years ago

emersonlaurentino commented 3 years ago

Hi, I am using firestore to database and I have this model:

// Products
{
  createdBy: "userId",
  ...
}
// Users
{
  id: 123,
  latitude: "2.87",
  longitude: "3.44"
  ...
}

I want to make a query that brings the products close to the user from the location.

Do you have any idea how should I do it?

prescottprue commented 3 years ago

This is not built into Firestore by default, for functionality like this you will want to checkout something like GeoFirestore that uses a specific object structure for querying for location/distance.

This is out of the scope of this library