Process Flow - Deleting documents
Start
Identify Document
Call Delete Method
Check Success?
No→Error Handling
Yes
Document Removed
End
This flow shows how a document is deleted: find it, delete it, check if successful, then finish.
const docRef = firestore.collection('users').doc('user123'); await docRef.delete();
| Step | Action | Document Reference | Result | Notes |
|---|---|---|---|---|
| 1 | Create reference to document 'user123' | users/user123 | Reference created | Ready to delete |
| 2 | Call delete() on document reference | users/user123 | Delete request sent | Waiting for confirmation |
| 3 | Firestore processes delete | users/user123 | Document deleted | Document no longer exists |
| 4 | Confirm deletion success | users/user123 | Success | No errors |
| 5 | End process | - | - | Document removed from database |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 | Final |
|---|---|---|---|---|---|
| docRef | undefined | Reference to users/user123 | Same | Same | Same |
| deleteStatus | undefined | undefined | Pending | Success | Success |
Deleting documents in Firestore: 1. Create a reference to the document. 2. Call delete() on that reference. 3. The operation is asynchronous. 4. Firestore confirms deletion or no error if missing. 5. Document is removed from the database.