Reputation: 1792
I am trying to delete a document in Firestore using the
Firestore.instance
.collection('Users')
.document('${user.uid}')
.collection('Pets')
.document('${dogNameList[index]}')
.delete()
When this happens, I see the Firestore console and the correct document to be deleted is greyed out, however, it is not deleted:
Next, when I create a new pet in this case, for some reason, if this pet has the same name 'Turbo' as the greyed out document name on the console, it inherently gets all the data which the old supposedly deleted 'Turbo' document has... This means that the document is not really being deleted but is rather going into some hibernation state or something like that... I need to know how I can permanently delete this document programmatically!
Thanks a lot and I really appreciate your help!
Upvotes: 0
Views: 907
Reputation: 317427
When you see an document id in italics, the only thing that means is that the document doesn't exist, but it has nested subcollections that are still present. If you click the document ID, you should be able to see those subcollections. This is why the document ID is still visible - to let you navigate to those subcollections in the console.
If you want to delete those subcollections as well, you will need to write code to delete all their documents.
See also: Delete a Document with all Subcollections and Nested Subcollections in Firestore
Upvotes: 4