mongoose: update element in json array
问题 I'm trying to update a user document that looks like this: { _id:"xyzdon'tcare", username:"john", examTrials:Array[ { trialId:"x1", examId:"y", questions:Array[ {ques1 Object}, {ques2 object} ] }, { trialId:"x2", examId:"z", questions:Array[ {ques1 Object}, {ques2 object} ] }] } I tried the most straightforward way, findOne() then modify the document then save().The problem is, I faced race condition problems with the document versions when a new request arrived before the previous update