How To Update Fields In Firestore Map
Don't know how to go about adding new fields into a map in Firestore using a variable rather then a hardcoded field name. I have a data structure in firestorm. The collection is ca
Solution 1:
You'll need to use the full field path as the key of the update:
var setWithMerge = cityRef.set({
`people.${x}`: y
});
This will prevent re-writing the entire "people" field, since you are specifying which property of the map to change directly.
Note that the field name and the property name are separated by a period.
Post a Comment for "How To Update Fields In Firestore Map"