Firebase V9 Firestore Update Document Data Using setDoc()
4 min readJul 11, 2022
There are two methods you can use to update an existing document in Firebase Version 9 Cloud Firestore.
- setDoc() → you’re here
- updateDoc()
Note: Before going any further, you’ll need to do three things:
- Create A Firebase Project from Firebase Console
- Register an app for Web (JavaScript)
- Add Firebase SDK to JavaScript Web App
Using the setDoc() method, you can update
- Entire existing document or
- Specific document field in the Firestore Database.
In addition to that, you can also add a brand new document to a collection using setDoc() method.
Firestore Update Entire Document
Here is the sample data stored in the Cloud Firestore.
Let’s update an entire document using the setDoc() method.
In order to update data entirely using the setDoc() method, we need three methods.
- getDatabase() → where we want to update a…