Limit the number of queried items from GeoFire

后端 未结 2 554
南笙
南笙 2021-01-15 09:37

I have a lot of entry in the same location. I would like only to get the 10 latest added items using Geofire. I know that it can be done easily with firebase using Query.lim

2条回答
  •  执笔经年
    2021-01-15 10:18

    There is only one solution for this :

    you should begin a query with a small radius,

    and each time you reach onGeoQueryReady() ("All data has been loaded"), you increase the radius by a small amount of the geoquery with .setRadius(r) until you reach the limit you want

    based on this https://github.com/firebase/geofire-js/issues/59

提交回复
热议问题