diff --git a/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java index 90b1268133..a7db26eba5 100644 --- a/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java +++ b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java @@ -68,4 +68,8 @@ public class MongoConfig extends AbstractMongoClientConfiguration { return new MongoTransactionManager(dbFactory); } + @Override + protected boolean autoIndexCreation() { + return true; + } }