With the latest Spring Data Lovelace Milestone 2 release, the MongoDB module is stacking up new features that are coming your way in the near future. As you might have followed in the news, MongoDB 4 is going to bring ACID transactions to the Document store. The latest MongoDB 3.6 server release already ships with the main building block for those, client sessions.
You can read all about isolation levels and causal consistency in the MongoDB reference. In short, sessions let you execute operations in an order that respects their causal relationships.
With Spring Data MongoDB,
ClientSession is right at your fingertips for both the imperative and the reactive world, as we have incorporated those into the already existing
ReactiveMongoOperations. To provide you with the utmost control and still enough convenience, managing the
ClientSession lifecycle is up you, while the template takes care of passing the session on to the driver correctly. The following example shows how to create a