What did MongoDB not being ACID compliant before v4 really mean?

前端 未结 10 1144
情书的邮戳
情书的邮戳 2020-12-04 04:15

I am not a database expert and have no formal computer science background, so bear with me. I want to know the kinds of real world negative things that can happen

10条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 05:12

    Please read about the ACID properties to gain better understanding.

    Also in the MongoDB documentation you can find a question and answer.

    MongoDB is not ACID compliant. Read below for a discussion of the ACID compliance.

    1. MongoDB is Atomic on document level only. It does not comply with the definition of atomic that we know from relational database systems, in particular the link above. In this sense MongoDB does not comply with the A from ACID.
    2. MongoDB is Consitent by default. However, you can read from secondary servers in a replica set. You can only have eventual consistency in this case. This is useful if you don't mind to read slightly outdated data.
    3. MongoDB does not guarantee Isolation (again according to above definition):
    1. For systems with multiple concurrent readers and writers, MongoDB will allow clients to read the results of a write operation before the write operation returns.
    2. If the mongod terminates before the journal commits, even if a write returns successfully, queries may have read data that will not exist after the mongod restarts.

    However, MongoDB modifies each document in isolation (for inserts and updates); on document level only, not on multi-document transactions.

    1. In regards to Durability - you can configure this behaviour with the write concern option, not sure though. Maybe someone knows better.

    I believe some research is ongoing to move NoSQL towards ACID constraints or similar. This is a challenge because NoSQL databases are usually fast(er) and ACID constraints can slow down performance significantly.

提交回复
热议问题