Skip to content

BulkWriter.writeToMultipleCollections breaks transaction support #5247

Description

@IsNull

We have observed that transactions do not propagate with the new multi collection Bulk update, as soon as multiple collections are involved.
I think I tracked the issue down to here: https://github.com/spring-projects/spring-data-mongodb/blob/main/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/BulkWriter.java#L110C1-L111C1

The BulkWritter.writeToMultipleCollections uses MongoTemplate.doWithClient(client -> client.bulkWrite(, and does not use the overload with the client-session. In contrast to this, the single collection path uses MongoTemplate.execute which seems to pass on the client session.

I hope this helps to resolve the issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions