Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

firestore add to field array

DocumentReference washingtonRef = db.collection("cities").document("DC");

// Atomically add a new region to the "regions" array field.
washingtonRef.update("regions", FieldValue.arrayUnion("greater_virginia"));

// Atomically remove a region from the "regions" array field.
washingtonRef.update("regions", FieldValue.arrayRemove("east_coast"));
 
PREVIOUS NEXT
Tagged: #firestore #add #field #array
ADD COMMENT
Topic
Name
1+6 =