Reputation: 33
I have an application with the following firestore data structure:
Now, when I want to delete a group, all it's members must be deleted accordingly. When I do this with a batched delete, the possibility exists that, when the client is offline, in the meanwhile new members are added so not everything will be deleted properly. How can I achieve this so everything about the group is properly removed ?
Upvotes: 2
Views: 3261
Reputation: 217
Using the firebase-cli:
firebase firestore:delete -r /<collection path>
firebase firestore:delete --all-collections
Upvotes: 2
Reputation: 598728
I recommend implementing this in Cloud Functions. You can either trigger that directly with a HTTP trigger, or through Cloud Firestore itself.
The latter has the advantage that the "delete" command can be sent/queued by a client while it is not connected, and will then be synchronized and executed correctly when it is next online.
Upvotes: 3