mongo db find one and do something then find one and update code example
Example: mongoid find_one_and_update
Model.where(id: id).find_one_and_update({
:$inc => {
payload
}
},
upsert: true,
return_document: :after
)
Model.where(id: id).find_one_and_update({
:$inc => {
payload
}
},
upsert: true,
return_document: :after
)