📜  firestore 批量添加数组 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:46.103000             🧑  作者: Mango

代码示例1
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();
}