0

I'm working with Cloud Firestore and my app is location based. I want to present the user results according to their current location, start with the closest and continue as it gets further. I also of course want to paginate as there are many items in my database and I don't want to pull them all.

How can I order results by distance without reading all the documents, so I could limit the documents I get?

Tsabary
  • 3,119
  • 2
  • 24
  • 66
  • Check [GeoFirestore library for Android](https://github.com/imperiumlabs/GeoFirestore-Android). – Alex Mamo Jun 18 '19 at 10:06
  • There is no way to get GeoFirestore results by distance without reading all the documents in the queried range first. See my answers: https://stackoverflow.com/questions/55329334/how-can-i-use-a-geoquery-to-sort-by-both-location-and-certain-value-android/55329416#55329416, https://stackoverflow.com/questions/54600722/in-order-to-sort-geoquery-results-by-distance-must-i-read-the-entire-dataset/54603092#54603092, https://stackoverflow.com/questions/56572432/is-there-a-way-i-can-combine-a-geofirestore-query-with-a-normal-firestore-query/56572832#56572832 and https://stackoverflow.com/a/56214037 – Frank van Puffelen Jun 18 '19 at 14:49

0 Answers0