I have a ios location based app. A user needs to be able to see nearby users within a certain radius. is there a way to read the nearby user documents in batches so that i don't unnecessarily load too many documents that the user won't scroll through. So first show 20 nearby users. then when the user scrolls down and reaches the last (20th) item in the collection, load 20 more nearby users who have not already been loaded (still within the desired radius).
Something like this is easy to do if i'm just reading users in by their join/sign up date. but i'm not sure how to do this for a location based query.
Is my only option to query on a small radius and then increase the radius (which will load some of the documents that have already been loaded from the database in previous query) and then deal with duplicate documents on the client side?
If you look at the documented solution for implementing geoqueries on Firestore, you'll see that it doesn't load the documents in order of proximity but in geohash blocks that looks like this:
The only workaround is indeed to start with a smaller radius to load the documents who are nearer, and expand the radius until you have loaded the required number of documents.
Also see: