【发布时间】:2020-10-05 12:20:26
【问题描述】:
大家好,我正在查看 firebase 的官方网站如何从集合中检索所有文档,但它只给了我 1,它不是第一个,也不是最后一个,而是在中间的某个地方,它总是一样的对象,我不明白为什么会这样。你能检查一下,也许看看我做错了什么?我总是得到文件:“companion_live”
private firestore: AngularFirestore;
constructor(private routingService: RoutingService, firestore: AngularFirestore) {
this.firestore = firestore;
}
async ngAfterViewInit() {
const citiesRef = this.firestore.firestore.collection('user');
const snapshot = await citiesRef.get();
snapshot.forEach((doc) => {
this.allTruckRoute.push(doc.id);
});
if (this.allTruckRoute.length > 0) {
this.allTruckRoute.forEach(route => this.trucks.push({id: route, selected: false} as SelectedTrucks));
}
}
这是我的架构的样子:
【问题讨论】:
标签: javascript firebase google-cloud-firestore angularfire2