免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
ACID transactions in MongoDB
- In this video, we'll look at how ACID transactions work with the document model in MongoDB. We'll cover the difference between single and multi-document transactions in MongoDB and discuss when you should use a multi-document ACID transaction. Remember, an ACID transaction is a set of database operations that must be atomic. That is, they must either happen all together successfully or fail together all at the same time. Due to the nature of the document model, database operations that only affect one document are inherently atomic in MongoDB. In other words, an operation like updateOne which is used to update a single document is technically an ACID transaction. This means that if we use updateOne to update multiple fields in a document, as we see in this example, either the quantity, details, and tags fields will all be updated or none of them will be. These changes will all be visible to clients at the same…