I am developing a Vue application with Firebase.
My firestore structure Photo
I want to update all field of Id: 5
My code
import * as fb from '../firebase';
const DOC_ID = "xyz";
fb.db.collection("orders").doc(DOC_ID).update({
regions: fb.db.FieldValue.arrayUnion({ Id: 5, Name: "newName", Mail: "new@email.com", ContactNo:
"100000000" })
});
But I am getting error:
TypeError: Cannot read property 'arrayUnion' of undefined
I've tried this solutions but nothing work for me
How to update an "array of objects" with Firestore?
https://firebase.google.com/docs/firestore/manage-data/add-data#update_elements_in_an_array