This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Data MongoDB 4.5.4! |
Migration Guide from 4.x to 5.x
Spring Data MongoDB 4.x requires the MongoDB Java Driver 5.5.x
To learn more about driver versions please visit the MongoDB Documentation.
UUID Representation Changes
Spring Data no longer defaults UUID settings via its configuration support classes, factory beans, nor XML namespace.
In order to persist UUID values the UuidRepresentation
hast to be set explicitly.
-
Java
-
XML
@Configuration
static class Config extends AbstractMongoClientConfiguration {
@Override
protected void configureClientSettings(MongoClientSettings.Builder builder) {
builder.uuidRepresentation(UuidRepresentation.STANDARD);
}
// ...
}
<mongo:mongo-client>
<mongo:client-settings uuid-representation="STANDARD"/>
</mongo:mongo-client>
BigInteger/BigDecimal Conversion Changes
Spring Data no longer defaults BigInteger/BigDecimal conversion via its configuration support classes.
In order to persist those values the default BigDecimalRepresentation
hast to be set explicitly.
@Configuration
static class Config extends AbstractMongoClientConfiguration {
@Override
protected void configureConverters(MongoConverterConfigurationAdapter configAdapter) {
configAdapter.bigDecimal(BigDecimalRepresentation.DECIMAL128);
}
// ...
}
Users upgrading from prior versions may choose BigDecimalRepresentation.STRING
as default to retain previous behaviour.