mongodb $set updates different fields of the same document, resulting in dirty data?
High concurrency may update different fields at the same time, such as two people updating at the same time, A updating field one, B updating field two. Is it possible that A updates while B updates, and then A updates the fields back? There is an article saying that $set is to update a field, and this operation is atomic. But I didn"t see this description in more places or more authoritative places. It"s not going to cause the problem I mentioned above, is it?
mongoDB modifier $set by lockymeng
probably the following two sentences execute
db.users.update ({" name ":" mfw "}, {" $set ": {" addr ":" shandong "}})
db.users.update ({" name ":" mfw "}, {" $set ": {" mobile ":" 1333333333 "}})
Correction. It has been confirmed that it is an atomic operation. I didn"t look at it carefully, but I still wonder whether it affects updating different fields at the same time
.