本文介绍了在Firestore API中进行分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Firestore Beta对文档进行分页.我正在关注官方文档
I am trying to paginate documents with firestore beta. I am following the official docs
我看到有一个pageSize参数来说明要显示多少个文档,但是我看不到任何偏移量选项.有人知道我该怎么做分页系统吗?
I see there is a pageSize param to say how many documents you want to show, but i dont see any offset option. Does anybody know how can i do a pagination system?
谢谢
推荐答案从您的文档链接中,我假设您正在使用REST API.在REST API中,可以指定一个pageToken参数.这可以从上一个请求返回的nextPageToken派生.
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.
{ "documents": [ { object(Document) } ], "nextPageToken": ABCDEF1234567890, }下一个请求
projects/my-project/databases/my-database/documents or projects/my-project/databases/my-database/documents/chatrooms?pageSize=20&pageToken=ABCDEF1234567890更多推荐
在Firestore API中进行分页
发布评论