2 / 3
Aug 2024

Hi All,
I am using the spring-data-mongodb-4.2.1 library and have created a repository using the MongoRepository.class.
I attempted to save data to a collection using the repository.save(obj) method, which was called inside a method annotated with @Transactional. Occasionally,
I encounter the error ‘writeConcern is not allowed within a multi-statement transaction’. This issue is intermittent and difficult to reproduce. Interestingly, the save operation succeeds if I call the API a second time.

Do you have any suggestion?

Hi Jeff,

Thank for quick response.
I am check by using db.version() and result is 5.0.28.
And in my java project using spring-data-mongodb-4.2.1

what should I do?

Thank you.