4.0.1 breaks aggregation projection $map functionality #4370
Labels
status: waiting-for-feedback
We need additional information before we can continue
type: documentation
A documentation update
With 4.0.1, specifically #4240, it's not possible to use Spring
AggregationExpression
in$map
of$project
stage. Aorg.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for CodecCacheKey{clazz=class org.springframework.data.mongodb.core.aggregation.ConditionalOperators$IfNull
is thrown. It is not specific toIfNull
tho.What I want to achieve:
document in mongodb:
Desired result
with following aggregation:
With 4.0.0:
With 4.0.1:
I attached an example project to reproduce the scenario. With Spring Boot 3.0.1, both tests will pass, with >3.0.1 one will fail.
my analysis
With 4.0.1 - because of #4240 - the pipeline is not mapped anymore in
AggregationUtil::createPipeline
.While I still can achieve my desired outcome, I still wanted to bring this up as it feels like a breaking change. But maybe what I did until 4.0.0 was not the "right" way to begin with? In that case I'd be happy for pointers how I should solve my problem with Spring Data MongoDB.
spring-data-mongodb-agg-project-map.zip
The text was updated successfully, but these errors were encountered: