Skip to content

Instantly share code, notes, and snippets.

@MorenoMdz
Created October 19, 2020 14:59
Show Gist options
  • Save MorenoMdz/f2b44fa05ef02606667e9e45557e0577 to your computer and use it in GitHub Desktop.
Save MorenoMdz/f2b44fa05ef02606667e9e45557e0577 to your computer and use it in GitHub Desktop.
Clear firestore collection from emulator
// Paste this in:
function clearCollection(path) {
const ref = firestore.collection(path)
ref.onSnapshot((snapshot) => {
snapshot.docs.forEach((doc) => {
ref.doc(doc.id).delete()
})
})
}
// Use it like this:
clearCollection('layers')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment