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

前端 未结 10 1145
情书的邮戳
情书的邮戳 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:18

    As of MongoDB v4.0, multi-document ACID transactions are to be supported. Through snapshot isolation, transactions will provide a globally consistent view of data, and enforce all-or-nothing execution to maintain data integrity.

    They feel like transactions from the relational world, e.g.:

    with client.start_session() as s:
        s.start_transaction()
        try:
            collection.insert_one(doc1, session=s)
            collection.insert_one(doc2, session=s)
            s.commit_transaction()
        except Exception:
            s.abort_transaction()
    

    See https://www.mongodb.com/blog/post/multi-document-transactions-in-mongodb

提交回复
热议问题