【发布时间】:2021-07-14 11:28:15
【问题描述】:
基于此: Can Firestore update multiple documents matching a condition, using one query?
我在下面做了,但不太确定为什么会出现此错误:doc.update 不是函数。
let db = firebase.firestore()
db.collection('posts')
.where('uid', '==', userId)
.get()
.then((snapshots) => {
snapshots.forEach((doc) =>
doc.update({
username: username,
})
)
})
所有帖子都有一个 uid 字段,我正在尝试更改用户名。
【问题讨论】:
标签: javascript firebase google-cloud-firestore