March 2019
Intermediate to advanced
394 pages
11h 4m
English
Document-level and collection-level locking is mentioned throughout this chapter and also in several other chapters in this book. It is important to understand how locking works and why it is important.
Database systems use the concept of locks to achieve ACID properties. When there are multiple read or write requests coming in parallel, we need to lock our data so that all readers and writers have consistent and predictable results.
MongoDB uses multi-granularity locking. The available granularity levels in descending order are as follows:
The locks that MongoDB and other databases use are the following, in order of granularity:
Read now
Unlock full access