Grokking MongoDB
0% completed
Transactions in MongoDB
Alice sends Bob 50. The application subtracts 50 from Alice's account, and then the server crashes before it adds 50 to Bob's account. The 50 has disappeared, and no error will ever tell you so.
MongoDB makes a write to one document atomic, meaning that the write applies completely or not at all. Alice and Bob are two documents, however, so that guarantee does not help here. A transaction is the tool for this case: it is a group of operations on any number of documents that either all take effect or all have no effect. MongoDB transactions follow the ACID properties
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%