diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoOperations.java index 65396bc7f..22b8e930a 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoOperations.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoOperations.java @@ -259,9 +259,21 @@ public interface MongoOperations extends FluentMongoOperations { /** * Create an uncapped collection with a name based on the provided entity class. + *

+ * This method derives {@link CollectionOptions} from the given {@code entityClass} using + * {@link org.springframework.data.mongodb.core.mapping.Document} and + * {@link org.springframework.data.mongodb.core.mapping.TimeSeries} annotations to determine: + *

+ * Any other options such as change stream options, schema-based details (validation, encryption) are not considered + * and must be provided through {@link #createCollection(Class, CollectionOptions)} or + * {@link #createCollection(String, CollectionOptions)}. * * @param entityClass class that determines the collection to create. * @return the created collection. + * @see #createCollection(Class, CollectionOptions) */ MongoCollection createCollection(Class entityClass); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java index 90f2d2345..19802b47f 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java @@ -214,9 +214,21 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations { /** * Create an uncapped collection with a name based on the provided entity class. + *

+ * This method derives {@link CollectionOptions} from the given {@code entityClass} using + * {@link org.springframework.data.mongodb.core.mapping.Document} and + * {@link org.springframework.data.mongodb.core.mapping.TimeSeries} annotations to determine: + *

    + *
  • Collation
  • + *
  • TimeSeries time and meta fields, granularity and {@code expireAfter}
  • + *
+ * Any other options such as change stream options, schema-based details (validation, encryption) are not considered + * and must be provided through {@link #createCollection(Class, CollectionOptions)} or + * {@link #createCollection(String, CollectionOptions)}. * * @param entityClass class that determines the collection to create. * @return the created collection. + * @see #createCollection(Class, CollectionOptions) */ Mono> createCollection(Class entityClass);