【发布时间】:2021-04-29 15:48:42
【问题描述】:
我想遍历一个集合并更新文档。我找到了这篇文章:Is there a method to iterate through all documents in a collection in firestore 显示了如何读取数据。我重写了这段代码来更新文档。但它似乎不起作用,因为我需要写入数据:
const db = firebase.firestore();
db.collection("users_highscores").get().then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
doc.update({
highscores_daily: {}
})
});
});
我收到此错误:Uncaught (in promise) TypeError: doc.update is not a function
我认为迭代和编写我需要做一些根本不同的事情的数据,但我现在不知道。我希望你能帮助我
【问题讨论】:
标签: javascript firebase google-cloud-firestore