document_family
This package deletes a firestore document and all its sub-collections.
Warnings
- To delete a collection, all documents within that collection must be deleted first.
- If the current document is deleted before its sub-collections, you will no longer be able to access these sub-collections.
- Before attempting, you must stop all write operations to the document and collections.
- Be careful of the deletion order to avoid permission issues. (Key data related to permissions should be deleted last.)
Getting Started
final DocumentReference docRef = FirebaseFirestore.instance
.collection('some-collection')
.doc('example123');
final children = [
{'collection': 'members'},
{'collection': 'requestingMembers'},
{
'collection': 'tracking',
'children': [
{'collection': 'history'},
],
},
];
await DocumentFamily(docRef, children).delete();