1let washingtonRef = db.collection('cities').doc('DC');
2
3// Atomically add a new region to the "regions" array field.
4let arrUnion = washingtonRef.update({
5 regions: admin.firestore.FieldValue.arrayUnion('greater_virginia')
6});
7// Atomically remove a region from the "regions" array field.
8let arrRm = washingtonRef.update({
9 regions: admin.firestore.FieldValue.arrayRemove('east_coast')
10});
1var washingtonRef = db.collection("cities").doc("DC");
2// Atomically add a new region to the "regions" array field.
3washingtonRef.update({
4 regions: firebase.firestore.FieldValue.arrayUnion("greater_virginia")
5});
6// Atomically remove a region from the "regions" array field.
7washingtonRef.update({
8 regions: firebase.firestore.FieldValue.arrayRemove("east_coast")
9});