Created
October 19, 2020 14:59
-
-
Save MorenoMdz/f2b44fa05ef02606667e9e45557e0577 to your computer and use it in GitHub Desktop.
Clear firestore collection from emulator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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