updateDoc, doc

To update some fields of a document without overwriting the entire document, use the update() method:

import { doc, updateDoc } from "firebase/firestore";

const washingtonRef = doc(db, "cities", "DC");

// Set the "capital" field of the city 'DC'
await updateDoc(washingtonRef, {
  capital: true
});

Last updated

Was this helpful?