Home > OS >  Firebase notification or alert for deletion of a collection
Firebase notification or alert for deletion of a collection

Time:11-02

In Firestore, I have seen multiple ways to restrict the deletion of documents with security rules and to prevent the deletion of a collection by using Acess Controls.

But is there a way to get a notification or an alert when a collection is deleted in Firestore?

Deleting a collection is critical and it's surprising that there is no easy way to stay aware of it.

CodePudding user response:

Collections are automatically created when a first document is added to them, and automatically removed when the last document is removed from them. There is no notification for either of these events though.

If you have a use-case that requires knowing when the collection is created/deleted, you'll have to detect adding the first document/removing the last document in your application code with a query.

  • Related