mongo find one and update code example
Example 1: mongodb updateone
db..updateOne({ id : 8400704 },{ $set: { name : "John" } })
Example 2: mongoid find_one_and_update
Model.where(id: id).find_one_and_update({
:$inc => {
payload
}
},
upsert: true,
return_document: :after
)