From the course: MongoDB Essential Training
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Transactions - MongoDB Tutorial
From the course: MongoDB Essential Training
Transactions
- [Instructor] In MongoDB, an operation on a single document is atomic. If person A issues a command to change some values in a document and person B issues a command to read the same document, there are two things that can happen. Either the read will happen before the document has changed or the read will happen after the document is changed. You will not receive the document with partial changes. However, if person A issues a command to change values in multiple documents and person B tries to read the same documents at the same time, person B could see some documents that have changes already and some that do not. If this is problematic for your application, then you need transactions. Transactions guarantee atomicity of reads and writes to multiple documents. That means a read within a transaction returns all documents as they were when the read began. For writes in a transaction, that means that either all writes…
Contents
-
-
-
-
-
-
(Locked)
insertOne and insertMany4m 58s
-
(Locked)
findOne and find7m 49s
-
(Locked)
Comparison operators6m 11s
-
(Locked)
Logical operators7m 55s
-
(Locked)
Sort, skip, limit4m 8s
-
(Locked)
updateOne and updateMany4m 36s
-
(Locked)
Arrays10m 2s
-
(Locked)
Transactions5m 2s
-
(Locked)
$expr5m 28s
-
(Locked)
Challenge: Create app1m 22s
-
(Locked)
Solution: Create app6m
-
(Locked)
-
-
-
-