Upsert mutation replacing entire document

I’m trying to use upsert mutation in one of my project. When the query matches with existing document, upsert mutation is replacing the whole document instead of specific fields passed down through data argument.

The expected behaviour is, it should be updating the fields which are provided through the data argument.

Also in the docs , it says upsert replacing the document. Please confirm this & suggest any other workarounds.