Course lesson
Avoid Duplicating Documents in Firestore
We'll explore what happens when we don't differentiate between a document update and creation leading to duplicated documents in our database.
- Duration
- 3 min
- Access
- Included
- Transcript
- Retained from source evidence
We'll explore what happens when we don't differentiate between a document update and creation leading to duplicated documents in our database.
We'll see how to fix this and make sure that when we send an update to Firestore we don't duplicate data but update the actual document in the database. In our saveTask function we will check to see if the tasks id is new and if it is we'll keep the functionality we have. If the task id isn't new then we have a task already and we'll use updateDoc to update that existing task.