Base on this: Can Firestore update multiple documents matching a condition, using one query?
I do below but not very sure why I am getting this error: doc.update is not a function.
let db = firebase.firestore()
db.collection('posts')
.where('uid', '==', userId)
.get()
.then((snapshots) => {
snapshots.forEach((doc) =>
doc.update({
username: username,
})
)
})
All the posts have a uid field and I am trying to change the username.
