在Firestore API中进行分页

编程入门 行业动态 更新时间:2024-10-28 02:20:31
本文介绍了在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中进行分页

本文发布于:2023-11-26 03:41:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1632494.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分页   Firestore   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!