Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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();
}
 
PREVIOUS NEXT
Tagged: #firestore #batch #add #array
ADD COMMENT
Topic
Name
6+1 =