Pagination 如何最好地提供到firestore支持的分页列表的深度链接

Pagination 如何最好地提供到firestore支持的分页列表的深度链接,pagination,google-cloud-firestore,Pagination,Google Cloud Firestore,我正在评估用Firestore替换部分SQL数据库的可行性,到目前为止,这是一种乐趣 我想知道在列表中为给定页面提供可书签链接的最佳方式是什么?我已经成功地实现了分页,并且发现我需要维护 lastVisible: firebase.firestore.DocumentSnapshot[] = [] 要能够像这样来回遍历分页列表: if (this._paginator._pageIndex - 1 in this.lastVisible) { return ref.orderBy('dat

我正在评估用Firestore替换部分SQL数据库的可行性,到目前为止,这是一种乐趣

我想知道在列表中为给定页面提供可书签链接的最佳方式是什么?我已经成功地实现了分页,并且发现我需要维护

lastVisible: firebase.firestore.DocumentSnapshot[] = []
要能够像这样来回遍历分页列表:

if (this._paginator._pageIndex - 1 in this.lastVisible) {
  return ref.orderBy('date', 'desc').startAfter(this.lastVisible[this._paginator._pageIndex - 1]).limit(this._paginator.pageSize)
} else {
  return ref.orderBy('date', 'desc').limit(this._paginator.pageSize)
}
如果理解正确,我可以将整个文档或索引使用的值提供给startAfter和startAt方法。不管是哪种方式,要为在第245页打开的列表提供一个深度链接,我需要在URL中传递245个值才能完成这个

或者我需要重新查询从0到xxx页的所有项目,并记录所有最后的项目

你有没有想过如何最好地解决这个问题

有没有办法只使用数字索引,可以从页面和页面大小计算出来