I have a Firestore function where
admin
.firestore()
.collection('users')
.doc(context.params.userId)
.set({field1: false});
The problem is, this replaces the given user object with {field1: false}
. I want to be able to add {field1: false}
to the object while preserving all other existing fields, and also to be able to remove the field1
field from the object if it already exists.
How should I approach this?