spring-data-mongodb icon indicating copy to clipboard operation
spring-data-mongodb copied to clipboard

Mapping converter not applied for `ReactiveMongoTemplate::findAndReplace`

Open joostfarla opened this issue 1 year ago • 3 comments

I have registered a MappingMongoConverter component to perform custom conversions for all document reads and writes. When performing find / findOne / etc. operations, this works as expected. However, when using ReactiveMongoTemplate::findAndReplace, the conversion is not applied on the returned document (the MappingMongoConverter::read method is not called). Is this expected behavior? Thanks in advance!

joostfarla avatar Dec 31 '24 10:12 joostfarla

No, the imperative and reactive templates should map from/to documents using same conversion strategies. If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.

christophstrobl avatar Jan 07 '25 06:01 christophstrobl

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues avatar Jan 14 '25 06:01 spring-projects-issues

A minimal reproducible example can be found in this repository: https://github.com/joostfarla/spring-data-mongodb-4865. The DemoApplicationTests class demonstrates the failing and succeeding scenarios. If you need any additional information, please let me know!

joostfarla avatar Jan 14 '25 08:01 joostfarla