【发布时间】:2020-10-16 20:10:38
【问题描述】:
我正在使用以下查询在给定文档快照之前获取文档。当我使用降序时:false 我得到最初的 5 个文件,但我想要在给定文件之前立即获得 5 个文件。当我使用 descending: true 时,我得到一个空列表。请帮我。我在这里做错了什么。
Stream<QuerySnapshot> getConversationBefore(String currentUserID,String clientID,DocumentSnapshot documentSnapshot)
{
return Firestore.instance
.collection(FIREBASE_COLLECTION_MESSAGES)
.document(currentUserID)
.collection(clientID)
.orderBy(TIMESTAMP_FIELD, descending: false)
.endBeforeDocument(documentSnapshot)
.limit(5)
.snapshots();
}
【问题讨论】:
标签: firebase flutter google-cloud-firestore