首页 > 解决方案 > Firestore orderBy 布尔值和时间戳

问题描述

我有一个场景,我需要根据布尔值和时间戳字段对集合中的记录进行分页。所以像:

collection('jobs', ref =>
    ref.orderBy('asap', 'desc')
       .orderBy('posted')
       .startAfter(offset)
       .limit(this.batchSize)

asap是一个布尔值,posted是时间戳。

基本上我需要显示一个记录列表,其中列表中的第一条记录是asap=true那些,然后这些应该按发布日期排序。该列表继续包含具有asap=false的记录,当然所有这些都应按发布日期排序。

我怎样才能做到这一点?

标签: angulartypescriptfirebasegoogle-cloud-firestoreangularfire2

解决方案


推荐阅读