How to add multiple docs to a collection in firebase?

You can execute multiple write operations as a single batch that contains any combination of set(), update(), or delete() operations. A batch of writes completes atomically and can write to multiple documents.

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

array.forEach((doc) => {

  batch.set(db.collection('col').doc(), doc);
}
// Commit the batch
batch.commit().then(function () {
    // ...
});

You can create batch write like

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

in you array add updates

array.forEach((doc) => {
  var docRef = db.collection("col").doc(); //automatically generate unique id
  batch.set(docRef, doc);
});

finally you have to commit that

batch.commit()