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) Alters the index with given name.createIndex(IndexDefinition indexDefinition) Create the index for the providedIndexDefinitionfor the collection indicated by the entity class.voidDrops all indices from this collection.voidDrops an index from this collection.<T> Texecute(CollectionCallback<T> callback) Returns the index information on the collection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.mongodb.core.index.IndexOperations
ensureIndex
-
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
-
createIndex
Description copied from interface:IndexOperationsCreate the index for the providedIndexDefinitionfor the collection indicated by the entity class. If the index does not exist it will be created. Might error if the collection already defines an index with the same name but different settings.- Specified by:
createIndexin interfaceIndexOperations- Parameters:
indexDefinition- must not be null.- Returns:
- the index name.
-
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:IndexOperationsAlters the index with given name.- Specified by:
alterIndexin interfaceIndexOperations- Parameters:
name- name of index to change.options- index options.
-
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
-