Tester12
Tester12

Reputation: 1011

Unable to delete document in flutter cloudfirestore?

I'm using the below to code to delete the doc, but the delete operation is not done in cloudfirestore databased,still the data exist after delete, Please guide. Collection id:users,

document id: p0lncbJnslgsvtUHW7zcbauk62F3 db image
My cloud firestore version: cloud_firestore: ^0.13.4+2

 await Firestore.instance
    .collection(collectionId)
    .document(documentId)
    .delete();

Upvotes: 1

Views: 363

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317352

When you see a document ID in italics in the console, that document doesn't actually exist. It's shown because that document ID has subcollections nested under it (which you are not showing in your screenshot. If you want to delete those subcollections, you will need to query for and delete each document in those subcollections. There is no easy way around this in client applications. For server-side code, there are tools to delete a document and subcollections recursively.

See also:

Upvotes: 2

Related Questions