Pagination in firestore api

后端 未结 3 1790
故里飘歌
故里飘歌 2020-12-07 02:18

I am trying to paginate documents with firestore beta. I am following the official docs

I see there is a pageSize param to say how many documents you want to show, b

3条回答
  •  抹茶落季
    2020-12-07 03:16

    From your documentation link, I assume that you're using the REST API. In the REST API, there is a pageToken parameter, which you can specify. This can be derived from the nextPageToken returned from the previous request.

    Previous response

    {
      "documents": [
        {
          object(Document)
        }
      ],
      "nextPageToken": ABCDEF1234567890,
    }
    

    Next request

     projects/my-project/databases/my-database/documents or projects/my-project/databases/my-database/documents/chatrooms?pageSize=20&pageToken=ABCDEF1234567890
    

提交回复
热议问题