我有一个 firestore 集合,里面有一些文档。这些文档仅包含集合,不包含任何字段。因此,当我尝试获取根集合中的所有文档时,我得到的快照大小为零。有没有办法获取没有字段但里面有一些集合的文档?
我的 Firestore 结构是
您还可以看到文档的 id 以斜体显示
检索数据的代码
db.collection("transactions").get()
.then(snapshot => {
console.log(snapshot.size); returns zero
})
let date = '2017-12-20' //date to be set in doc
db.collection("transactions").doc(date).set({
//set an empty object for each doc in transaction before your method
//of setting data
//This will create a field for each doc in transaction
})
.then(()=>{
//your method of setting data here.
})
//Your query method here.
//Now you will be able to query the docs in collection - transaction.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)