Concurrency with MongoDB Explained
Letâs move back to practical usage and look at MongoDB since itâs the most used NoSQL database for Node.js applications.
MongoDB doesnât guarantee ACID compliance[40] in all cases. For example, MongoDB doesnât have transactions and atomic functions that cover multiple documents. So if you have a database model where you need to avoid concurrency issues with multiple documents at the same time, youâre in trouble. For example, you might have an e-commerce application that needs to decrement the number of products in the warehouse inventory while at the same time withdrawing money from the userâs wallet.
Get Secure Your Node.js Web Application now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.