Photo by Markus Spiske from Pexels.com

Delete Large Document or Collection from Firebase Cloud Firestore Using Console

Delete large collection or document from firebase cloud firestore can be frustrating. There is one way that could be wrong if you not careful. Make sure to backup your data or project before delete a lot thing, well who know right? Last week while working on my project developing application with Flutter, there is one large collection that I really need to delete ASAP. Usually, you just have to delete from the client side such browser or from the apps.

Delete large data from client side using console is simple, click on collection or document and hit “delete” but this not the case when your data is too big. Sometimes when you open large data from the browser it’s going to “not responding” in this case if you have big memory RAM that not going the problem. The trick we can use in here by disable our internet connection before all the data for particular collection is fully loaded and after that you can click the delete option and you need to activate the internet connection again and choose delete button as fast as possible.

Back to my case, I need to delete this collection, after searching from forum like stackoverflow or the cloud firestore documentation itself but in fact I can’t seeing the easiest way without deleting it by hand from the console.

There is one thing that I you need to know, from documentation itself “if you want to delete document and it’s subcollections, you must to do it by hand”. I tried to delete by hand from the console but you know the ending, right? Yup, the tab console it’s not responsive.

What’s the options?

If you have large collection, you can delete it in smaller batches to avoid memory out of error. Another option is to delete data with Firebase CLI. Firebase CLI is provide tools to help you for managing your project, view even deploy the project. Because I need to delete the collection ASAP, taking care the data by using smaller batch it’s time consuming. Using Firebase CLI, well I do not familiar with it. Actually, I’m just know it recently.

Delete data from Firebase Cloud Firestore

Illustration Delete Data from Firebase Cloud Firestore
Illustration Delete Data from Firebase

Fortunately, I succeed delete it from the console. Wait a minute, did I just tell you before it’s impossible to do it from the console. When you just open it large collection or document it’s going to freeze the and wait forever. So, how I did it? There is a trick. One thing to know that when is load data it’s need connection to the internet right?

When you click the collection or document it’s load as possible as long as is connected to the internet. What I did is when I click on the collection or documents, I disconnected from the internet as soon as possible before the large data is loading.

Don’t worry the menu delete from the “three dots’” is still available while it’s offline. Click the delete menu and enter the name of document that you want to delete and connect to the internet again and be ready to hit delete ASAP after you connected again.

Conclusion

Easy right? That’s how you can delete big collection or document from the console. It is impossible from the beginning but et voila it working. Hope this article can help you delete large data from the firebase cloud firestore using the console.


Posted

in

by

Tags:

Comments

Leave a Reply

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