1. 12
    Avoid Duplicating Documents in Firestore
    2m 55s

Avoid Duplicating Documents in Firestore

InstructorJorge Vergara

Share this video with your friends

Send Tweet

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.