【发布时间】:2020-12-03 08:18:13
【问题描述】:
我一直在尝试将子集合的文档快照放入列表中。它的代码是这样的:-
getcoffeebuyerlist() async {
DocumentSnapshot coffeebuyers;
List<DocumentSnapshot> finalCoffeBuyerList = [];
for (var i = 0; i < profiles.length; i++) {
coffeebuyers = await Firestore.instance
.collection('profileData')
.document(profiles[i].uid)
.collection('coffeeprices')
.document(profiles[i].uid)
.get();
finalCoffeBuyerList.add(coffeebuyers);
}
return finalCoffeBuyerList;
}
有两个配置文件,其中只有一个有子集合'coffeeprices'。
我的疑问是通过尝试获取子集合的快照,我是否会自动为不存在子集合的第二个配置文件创建一个空文档并将其放入finalCoffeBuyerList 列表中?
或者只有那些(在我的例子中)已经存在的子集合被添加到这个列表中?
【问题讨论】:
标签: firebase flutter firebase-realtime-database