DATAMONGO-2188 - Polishing.
Undo deprecation and transition to configuration option allowing to disable the index creation. Index creation will remain in the codebase as it is used in a lot of places to configure required geo index structures in MongoDB without which query execution would fail. Original Pull Request: #636
This commit is contained in:
@@ -377,8 +377,29 @@ public class Person {
|
||||
====
|
||||
|
||||
IMPORTANT: The `@Id` annotation tells the mapper which property you want to use for the MongoDB `_id` property, and the `@Indexed` annotation tells the mapping framework to call `createIndex(…)` on that property of your document, making searches faster.
|
||||
Automatic index creation is only done for types annotated with `@Document`.
|
||||
|
||||
IMPORTANT: Automatic index creation is deprecated since version 2.2 because controlling the actual time of index creation is rather difficult. Index creation can be part of the application startup, happen during runtime or an out of band process. Therefore, Spring Data MongoDB backs off entirely and recommends index creation to happen either out of band or as part of the application startup using `IndexOperations`. Automatic index creation is still available and is is only done for types annotated with `@Document`.
|
||||
[NOTE]
|
||||
====
|
||||
To turn automatic index creation _OFF_ please override `autoIndexCreation()` in your configuration.
|
||||
[source,java]
|
||||
----
|
||||
@Configuration
|
||||
public class Config extends AbstractMongoClientConfiguration {
|
||||
|
||||
@Override
|
||||
public boolean autoIndexCreation() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ...
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
IMPORTANT: Automatic index creation will be turned _OFF_ by default with the release of 3.x.
|
||||
We recommend index creation to happen either out of band or as part of the application startup using
|
||||
`IndexOperations`.
|
||||
|
||||
[[mapping-usage-annotations]]
|
||||
=== Mapping Annotation Overview
|
||||
|
||||
Reference in New Issue
Block a user