xxxxxxxxxx
Model.where(id: id).find_one_and_update({
:$inc => {
payload
}
},
upsert: true,
return_document: :after
)
xxxxxxxxxx
//You cannot apply cursor methods to the result of findOne()
//because a single document is returned. You have access to the document directly