From a recent MongoDB blog post, we can see that MongoDB as of major release 4.0 supports ACID:
MongoDB 4.0 will add support for multi-document transactions, making it the only database to combine the speed, flexibility, and power of the document model with ACID data integrity guarantees. Through snapshot isolation, transactions provide a globally consistent view of data, and enforce all-or-nothing execution to maintain data integrity.
If you happen to be using Spring, all you would have to do to make a method ACID compliant would be to annotate it with @Transactional
. The framework and Mongo would automatically handle the rest.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…