With my pymongo version: 3.2.2 I had do the following
from bson.objectid import ObjectId
import pymongo
client = pymongo.MongoClient("localhost", 27017)
db = client.mydbname
db.ProductData.update_one({
'_id': ObjectId(p['_id']['$oid'])
},{
'$set': {
'd.a': existing + 1
}
}, upsert=False)