Transactions In MongoDB

前端 未结 3 1504
借酒劲吻你
借酒劲吻你 2020-12-31 13:38

I am using a NoSQL database MongoDB with Java and Spring Data. I am aware that MongoDB only supports transactions for a single document.

I am using Spring Transacti

相关标签:
3条回答
  • 2020-12-31 13:48

    MongoDB doesn't support transactions, it only supports atomic operations.

    http://docs.mongodb.org/manual/tutorial/model-data-for-atomic-operations/

    Here is a post from someone who implemented transactions for MongoDB with optimistic locking: https://stackoverflow.com/a/12757751/1173560

    0 讨论(0)
  • 2020-12-31 14:01

    MongoDB does support transaction-like semantics using two-phase commits.

    There is also another independent effort to support transactions in mongodb using optimistic locking.

    0 讨论(0)
  • 2020-12-31 14:11

    Multi-document ACID transactions are now supported in MongoDB 4.0! See https://www.mongodb.com/blog/post/mongodb-multi-document-acid-transactions-general-availability

    0 讨论(0)
提交回复
热议问题