// This snippet file was generated by processing the source file: // ./firestore-next/test.firestore.js // // To update the snippets in this file, edit the source and then run // 'npm run snippets'. // [START update_document_array_modular] import { doc, updateDoc, arrayUnion, arrayRemove } from "firebase/firestore"; const washingtonRef = doc(db, "cities", "DC"); // Atomically add a new region to the "regions" array field. await updateDoc(washingtonRef, { regions: arrayUnion("greater_virginia") }); // Atomically remove a region from the "regions" array field. await updateDoc(washingtonRef, { regions: arrayRemove("east_coast") }); // [END update_document_array_modular]