Update set a field in mongodb while upsert from mongo-spark connector

Is there any way to do this: I have a requirement where if a data record already exists in mongoDb, I want to add and set while making the upsert operation from spark.

My data flow is from spark Dataframes to mongoDb

ex : Existing data in MongoDb
{_id: 1, name: xxx, itemsViewed: 125 }
{_id: 2, name: yyy, itemsViewed: 37 }

new Dataframe from spark needs upsert
{_id: 2, name: yyy, itemsViewed: 5}
{_id: 3, name: abc, itemsViewed: 10 }

resultant Data:
{_id: 1, name: xxx, itemsViewed: 125 }
{_id: 2, name: yyy, itemsViewed: 42 }
{_id: 3, name: abc, itemsViewed: 10 }