Module spring.data.mongodb
Class DefaultIndexOperations
java.lang.Object
org.springframework.data.mongodb.core.DefaultIndexOperations
- All Implemented Interfaces:
IndexOperations
Default implementation of
IndexOperations.- Author:
- Mark Pollack, Oliver Gierke, Komi Innocent, Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultIndexOperations(MongoOperations mongoOperations, String collectionName, Class<?> type) Creates a newDefaultIndexOperations.DefaultIndexOperations(MongoDatabaseFactory mongoDbFactory, String collectionName, QueryMapper queryMapper) Deprecated.since 2.1.DefaultIndexOperations(MongoDatabaseFactory mongoDbFactory, String collectionName, QueryMapper queryMapper, Class<?> type) Deprecated.since 2.1. -
Method Summary
Modifier and TypeMethodDescriptionvoidalterIndex(String name, IndexOptions options) Drops an index from this collection.voidDrops all indices from this collection.voidDrops an index from this collection.ensureIndex(IndexDefinition indexDefinition) Ensure that an index for the providedIndexDefinitionexists for the collection indicated by the entity class.<T> Texecute(CollectionCallback<T> callback) Returns the index information on the collection.
-
Constructor Details
-
DefaultIndexOperations
@Deprecated public DefaultIndexOperations(MongoDatabaseFactory mongoDbFactory, String collectionName, QueryMapper queryMapper) Deprecated.since 2.1. Please useDefaultIndexOperations(MongoOperations, String, Class).Creates a newDefaultIndexOperations.- Parameters:
mongoDbFactory- must not be null.collectionName- must not be null.queryMapper- must not be null.
-
DefaultIndexOperations
@Deprecated public DefaultIndexOperations(MongoDatabaseFactory mongoDbFactory, String collectionName, QueryMapper queryMapper, @Nullable Class<?> type) Deprecated.since 2.1. Please useDefaultIndexOperations(MongoOperations, String, Class).Creates a newDefaultIndexOperations.- Parameters:
mongoDbFactory- must not be null.collectionName- must not be null.queryMapper- must not be null.type- Type used for mapping potential partial index filter expression. Can be null.- Since:
- 1.10
-
DefaultIndexOperations
public DefaultIndexOperations(MongoOperations mongoOperations, String collectionName, @Nullable Class<?> type) Creates a newDefaultIndexOperations.- Parameters:
mongoOperations- must not be null.collectionName- must not be null or empty.type- can be null.- Since:
- 2.1
-
-
Method Details
-
ensureIndex
Description copied from interface:IndexOperationsEnsure that an index for the providedIndexDefinitionexists for the collection indicated by the entity class. If not it will be created.- Specified by:
ensureIndexin interfaceIndexOperations- Parameters:
indexDefinition- must not be null.
-
dropIndex
Description copied from interface:IndexOperationsDrops an index from this collection.- Specified by:
dropIndexin interfaceIndexOperations- Parameters:
name- name of index to drop
-
alterIndex
Description copied from interface:IndexOperationsDrops an index from this collection.- Specified by:
alterIndexin interfaceIndexOperations- Parameters:
name- name of index to hide.
-
dropAllIndexes
public void dropAllIndexes()Description copied from interface:IndexOperationsDrops all indices from this collection.- Specified by:
dropAllIndexesin interfaceIndexOperations
-
getIndexInfo
Description copied from interface:IndexOperationsReturns the index information on the collection.- Specified by:
getIndexInfoin interfaceIndexOperations- Returns:
- index information on the collection
-
execute
-