Back to articles
Consistency boundaries in SQL databases vs. MongoDB

Consistency boundaries in SQL databases vs. MongoDB

via Dev.toFranck Pachot

Two common myths surround database consistency: Myth 1 : Only SQL databases provide strong consistency. In fact, MongoDB—a NoSQL database—supports ACID transactions with strong consistency, even in sharded clusters, with clear boundaries: the document and the transaction. Myth 2 : SQL consistency is simple and fully abstracted, so you can treat views like tables and run transactions as if race-condition anomalies never occur. In reality, no RDBMS fully achieves this ideal, so you must understand each system’s consistency boundaries (column?, scanned rows?, returned rowset?, range?, partition?, table?). With MongoDB, the consistency boundaries follow domain driven design aggregates: concurrent writes to the same document conflict, even if they effectively read or write different fields. This guarantees that the database cannot break the business invariants set by the application. I've detailed an example in Serializable Transactions in MongoDB: The Doctor's On-Call Shift example . Docum

Continue reading on Dev.to

Opens in a new tab

Read Full Article
5 views

Related Articles