Why do my MongoDB simultaneous $push updates fail? Why do my MongoDB simultaneous $push updates fail? mongodb mongodb

Why do my MongoDB simultaneous $push updates fail?


As a workaround for this bug, I recommend using findAndModify and the checking the results to make sure your update happened.

    dbCollection.findAndModify({ "uuid": someUuid, "revision.versionNumber": someVersionNumber},[], { "$set": { "meta.someId": someId }, "$push": { "meta.someMessages": someMessage } }, {safe: true, 'new' : true}, function(err, updated){     if(err){     //handle the error    }    if(updated.meta.someMessages doesn't contain your message) {     //try it again or report it to the client    }         });