Mongodb concurrency problem

  mongodb, question

Pseudo code:

getData: function(req, res) {
 DataCollection.findOne({id: 'abc'}).exec((err, doc)=>{
 Console.log(doc.num) // assuming 1
 Do something with (doc.num)//doc.num is now assumed to be 34
 doc.save()
 Console.log(docs.num) // normally should be 34,45,56 .., but high concurrency is 34, 34, 34  ...
 return res.ok()
 })
 }

What should I do?

The problem is solved, search NPM to find out about redlock