[英]How to get the entire array back back from Firestore and not an object?
如何从Firestore而不是对象取回整个阵列?
我得到这个对象
相反,我想要一个数组
从我的firestore阵列中
到目前为止,这是我的代码。
fb.usersCollection
.doc(this.currentUser.uid)
.collection('fragebogen')
.doc('fragebogen1')
.get()
.then(snapshot => {
const data = snapshot.data()
console.log(data)
})
.catch(error => {
console.log(error)
})
snapshot.data()
返回一个对象,其中包含整个文档的内容。 对象的键是文档中字段的名称。 因此,如果该文档中的数组字段名为arr
,则您的数组将位于snapshot.data().arr
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.