0

I wanted to know if there are ACID guarantees in multi-document transactions in MongoDB. What's the current status, existing materials are quite old. What's been upgraded now?

How can we simulate to show that it can't, if it can't OR can, if it can?

Community
  • 1
  • 1
anz
  • 987
  • 7
  • 21

2 Answers2

3

MongoDB will add support for multi-document transactions starting from version 4.0, so you will have ACID guarantees in multi-document transactions. For details visit this link:

https://www.mongodb.com/blog/post/multi-document-transactions-in-mongodb?jmp=community

Pranab Sharma
  • 729
  • 10
  • 12
  • @anz, This is now a reality (ACID transaction was added with 4.0 release). Consider accepting this as an answer to help users – bagerard Oct 20 '19 at 19:48
1

To make muti-document write process atomic You can use $isolated Operator

Using the $isolated operator, a write operation that affects multiple documents can prevent other processes from interleaving once the write operation modifies the first document. This ensures that no client sees the changes until the write operation completes or errors out.

You can perform Two Phase Commits for transaction-like semantics.

Check MongoDB 3.2 documentation for more details.

Dev
  • 13,492
  • 19
  • 81
  • 174
  • As per the documentation - **The $isolated operator does not work on sharded clusters.** but did not find any comment on 2 phase Commit – Dev Dec 11 '15 at 08:50