How to retrieve paginated children in ascending or descending order in Firebase?

后端 未结 2 874
隐瞒了意图╮
隐瞒了意图╮ 2020-12-31 16:08

Suppose I\'m using firebase for a commenting system and I want to retrieve the comments for a given topic, but there are so many comments in one topic that I don\'t want to

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-31 16:56

    Here is solution from firebase docs:

    Query query = cities.orderBy("name", Direction.DESCENDING).limit(3);

    https://firebase.google.com/docs/firestore/query-data/order-limit-data

提交回复
热议问题