【发布时间】:2020-08-14 10:57:45
【问题描述】:
我正在尝试通过以下代码读取我的 Vue 应用程序上的 Firestore 数据库:
mounted() {
db.collection("tete-est")
.doc("inqueritos")
.onSnapshot(snapshot => {
snapshot.forEach(doc => {
this.inquerito.push({
codigo: doc.data().a_codAgr,
data: doc.data().a_data,
inquiridor: doc.data().a_nomeInq,
nome: doc.data().c1_nomeChefe
});
});
});
},
我收到了这个错误:
Uncaught TypeError: snapshot.forEach is not a function
[enter image description here][1]
我的数据库如下所示:
谁能帮忙?
【问题讨论】:
-
你到底想读什么?
inqueritos集合中的所有文档?
标签: javascript firebase vue.js google-cloud-firestore