In the guide for Firestore on deleting a whole collection, there is an example using firebase_tools.firestore.delete
. Where can I find documentation about this function? I only found it mentioned in the CLI reference but with little detail.
Asked
Active
Viewed 261 times
2

Louis Coulet
- 3,663
- 1
- 21
- 39
-
You learn this: https://firebase.google.com/docs/firestore/manage-data/delete-data – Sep 16 '20 at 15:12
-
1I don't think there's a lot more documentation. What do you want to know about the function? – Frank van Puffelen Sep 16 '20 at 15:19
-
@Tomasz Vizaint: thank you for the pointer but this page does not provide much info on the firebase_tools.firestore.delete CLI function – Louis Coulet Sep 16 '20 at 15:20
-
@Frank van Puffelen: As I would like to use this function in my app, I am interested in learning more about what the recursive delete does: does it delete subcollections as well, what are its limitation, for ex: max number of documents deleted, and how to use it with emulators – Louis Coulet Sep 16 '20 at 15:23
-
Note that you can programmatically use the Firebase CLI but only as a standard Node module. For example, you cannot use it like the JavaScript SDK from a Web/JS app. If you want to use the recursive deletion, you would need to write a Cloud Function and call it from your app. See https://stackoverflow.com/a/55916960/3371862 for a bit more details. – Renaud Tarnec Sep 16 '20 at 15:36
-
Thank you Renaud Tarnec, using the firebase-tools as a node module as you detail in the mentioned is exactly my plan, but I do not feel very confident about it, for example: what would happen if the collection is too large and the cloud function times out. That is why I was looking at additional info. I am still looking for the equivalent of a loyal DELETE FROM table WHERE 1; – Louis Coulet Sep 16 '20 at 15:57
1 Answers
1
In most cases the firebase-tools
library is only used in the CLI to Firebase projects. So the documentation for that command is in the reference docs for the CLI, but its admittedly a bit lightweight for the Firestore delete command.
Luckily the firebase-tools
library is open-source, so you can check exactly what it does by looking at the code. The firestore:delete
command is implemented here and here.
If you run into specific problems while implementing similar functionality, or have specific questions about it, I recommend posting those specific problems/questions. For example: the command indeed deletes subcollections.

Frank van Puffelen
- 565,676
- 79
- 828
- 807
-
Thank you, it is cool to see the code, and I got some info from the CLI help messages. As a side note, I agree that I should be more specific in my questions. – Louis Coulet Sep 16 '20 at 16:08
-
No worries there, as it's useful to share these links and showing that `firebase-tools` is a library and not just the CLI. It was mostly a "if you have a more specific problem, we can probably help more concretely". :) – Frank van Puffelen Sep 16 '20 at 16:51