Answers for "firestore batch add array"

1

firestore batch add array

var db = firebase.firestore();
var batch = db.batch()

save(docs: any[]) {
  docs.forEach((doc) => {
    var docRef = db.collection("col").doc(); //automatically generate unique id
    batch.set(docRef, doc);
  });
  return batch.commit();
}
Posted by: Guest on June-19-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language