Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for transactions (sync). [DATAMONGO-1920] #2819

spring-projects-issues opened this issue Apr 5, 2018 · 0 comments
in: core type: enhancement


Copy link

spring-projects-issues commented Apr 5, 2018

Christoph Strobl opened DATAMONGO-1920 and commented

Provide a MongoDB specific PlatformTransactionManager implementation.

The MongoTransactionManager should create and bind a ClientSession to the thread. Transactions are started, commited or aborted while MongoTemplate automatically detects existing ClientSessions and operates on them accordingly.

Without the presence of a MongoTransactionManager within the ApplicationContext the template should not participate in any what so ever ongoing transactions. Users have to actively opt in to transaction support. A flag on MongoTemplate should allow to enable transaction support for non native MongoDB transactions.

public class Config extends AbstractMongoConfiguration {

  MongoTransactionManager transactionManager(MongoDbFactory dbFactory) {
    return new MongoTransactionManager(dbFactory);

  // ...

public class NightAngel {

  @Autowired PersonRepository repository;

  public void trainAzoth() {

    Person durzo = repository.findByName("Durzo Blint");

    Person kylar = new Person("Kylar Stern");

Reference URL:

Issue Links:

  • DATAMONGO-2001 Count within session should return only the total count of documents visible to the specific session

  • DATAMONGO-1971 Install MongoDB on TravisCI ourselves

Referenced from: pull request #554

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: core type: enhancement
None yet

No branches or pull requests

2 participants