From reading the documentation for the set document operation, it seems to me that overwrite and merge mean the same thing which is to replace existing data with new ones. I'm not understanding the difference between the two, even they are phrased to have separate meanings here.
Specifically where it says
If the document does exist, its contents will be overwritten with the newly provided data, unless you specify that the data should be merged into the existing document, as follows: