Update And Return Document In Mongodb

后端 未结 4 1922
南笙
南笙 2020-11-29 09:39

I want to get updated documents. This is my original code and it succesfully updates but doesnt return the document.

collection.update({ \"code\": req.bo         


        
4条回答
  •  悲&欢浪女
    2020-11-29 10:29

    The solution is to set: {returnOriginal: false}.

    collection.findOneAndUpdate(
            whereObj,
            updateObj,
            {returnOriginal: false});
    

提交回复
热议问题