【发布时间】:2018-05-30 18:43:31
【问题描述】:
我有一个如下结构的文档列表。
Posts ->
->uuid_1
-> approvedCount : 5
-> postMsg : "Hello world 1"
-> Timestamp : 1234567890
-> userId : "user1"
->uuid_2
-> approvedCount : 6
-> postMsg : "Hello world 2"
-> Timestamp : 1234567891
-> userId : "user2"
firestore 中可能有数千个帖子,而且大小还在不断增加。
条件 -> approvedCount 在查询中过滤时必须大于 5。
现在我想每天按时间戳的升序获取 20 条记录。我不想重复,所以假设今天我按升序获取了 20 条第一条记录,明天我想获取接下来的 20 条记录,依此类推..
我尝试了类似的东西
FirebaseUtil.getFireStoreDB("Posts").whereGreaterThan("approvedCount", 5)
.limit(20)
.orderBy("Timestamp", Query.Direction.ASCENDING)
.get()
但不知道我将如何每天获取下一篇文章。因为从文档中我了解到您不能使用 查询 2 个字段,否则使用时间戳和批准计数会更容易
【问题讨论】:
标签: java android firebase google-cloud-firestore