【发布时间】:2018-10-21 06:13:54
【问题描述】:
在我的集合的 SnapshotListener 中,我通过以下方式遍历文档:
for (DocumentChange doc : queryDocumentSnapshots.getDocumentChanges()) {
if (doc.getType() == DocumentChange.Type.ADDED) {
String somestr = doc.getDocument.getString("someField");
// retrieve collection here
}
}
在 for 循环中的每个文档中,我们称之为 doc,我在 Cloud Firestore 上还有另一个文档集合。我想在doc 的子集合中检索所有文档(每个文档只有一个字符串字段)。我可以使用doc.getDocument 来获取doc 本身,我正在使用它来获取字符串字段,但我不知道如何获取其子集合中的文档。
【问题讨论】:
标签: android firebase google-cloud-firestore