15

After over a year of development, I have a pretty well developed site. Now I'm going to open it up for a public beta but I need to clear my Firestore of all it's data (it's all test data). Is there a simple way to do this or do I have to delete every single entry by hand? (There are over 1000 entries). The only realistic option I can think of at the moment is to switch Firebase projects to a new one, which is not something I want to do.

Solution: After reaching out to Firebase support, I was given the following CLI command to run, which did the trick:

// THIS WILL PROMPT CONFIRMATION AND WILL USE ACTIVE PROJECT
firebase firestore:delete --all-collections

// !!! WARNING !!! THIS WILL NOT PROMPT CONFIRMATION AND WILL USE ACTIVE PROJECT
firebase firestore:delete --all-collections -y

Remember to use caution, as this will wipe your entire Firestore database.

cbdeveloper
  • 21,907
  • 18
  • 110
  • 225
FiringBlanks
  • 1,772
  • 3
  • 26
  • 43
  • 2
    It's conventional (and strongly recommended) to develop in one project in isolation from another project that hosts your production data. So many things can go wrong if you develop against the same database that hosts production. – Doug Stevenson Nov 21 '18 at 20:24
  • I believe you can delete whole collection just by 1 click in firebase console? – William Chong Nov 21 '18 at 20:31
  • That correct William. An alternative is to delete them using the Firebase CLI. See https://stackoverflow.com/questions/47860812/deleting-all-documents-in-firestore-collection?rq=1 – Frank van Puffelen Nov 21 '18 at 20:39
  • @WilliamChong How would the 1-click method work in the Firebase console? – FiringBlanks Nov 21 '18 at 21:38

0 Answers0