Provide support to increase developer productivity in Java when using MongoDB. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

68 lines
1.9 KiB

[[mongodb.migration.4.x-5.x]]
= Migration Guide from 4.x to 5.x
Spring Data MongoDB 5.x requires the MongoDB Java Driver 5.6+ +
To learn more about driver versions please visit the https://www.mongodb.com/docs/drivers/java/sync/current/upgrade/[MongoDB Documentation].
== MongoDB Java Driver 4.x Driver Compatibility Removed
Spring Data MongoDB does no longer support the 4.x MongoDB Java Driver generation.
== 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.
[tabs]
======
Java::
+
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
----
@Configuration
static class Config extends AbstractMongoClientConfiguration {
@Override
protected void configureClientSettings(MongoClientSettings.Builder builder) {
builder.uuidRepresentation(UuidRepresentation.STANDARD);
}
// ...
}
----
XML::
+
[source,xml,indent=0,subs="verbatim,quotes",role="secondary"]
----
<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.
[source,java]
----
@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.
== JMX Support Discontinued.
We recommend switching to Spring Boot https://docs.spring.io/spring-boot/reference/actuator/endpoints.html[Actuator Endpoints].