How to delete all documents from a collection in Google Cloud Firestore?

const db = new Firestore({
  projectId: "projectId",
  keyFilename: "./key.json"
});

db.collection("collectionName")
  .get()
  .then(res => {
    res.forEach(element => {
      element.ref.delete();
    });
  });
Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *