Another difference (extending Scarygami's answer) between "set with merge" and "update", is when working with a nested values.
if you have a document structured like this:
{ "friends": { "friend-uid-1": true, "friend-uid-2": true, } }
and want to add {"friend-uid-3" : true}
using this:
db.collection('users').doc('random-id').set({ "friends": { "friend-uid-3": true } },{merge:true})
will result in this data:
{ "friends": { "friend-uid-1": true, "friend-uid-2": true, "friend-uid-3": true } }
however update using this:
db.collection('users').doc('random-id').update({ "friends": { "friend-uid-3": true } })
will result in this data:
`{ "friends": { "friend-uid-3": true } }`