2021年1月3日星期日

Update a field from all documents in Firebase

I am very new to Firebase and I am not sure how to update the same field in all documents in one collection.

  return db.collection('collection').get().then((snapshot) => {      return snapshot.forEach((doc) => {          doc.update({'field': 1});              });    })    .catch((err) => {      console.log('Error getting documents', err);    });  

I am running this code in a firebase function. There are no errors, but nothing is happening. I can't see anything in the documentation about this specific problem. Does anyone know what's wrong?

https://stackoverflow.com/questions/65557000/update-a-field-from-all-documents-in-firebase January 04, 2021 at 10:29AM

没有评论:

发表评论