Module spring.data.mongodb
Interface IndexOperations
- All Known Subinterfaces:
IndexOperationsAdapter
- All Known Implementing Classes:
DefaultIndexOperations
public interface IndexOperations
Index operations on a collection.
- Author:
- Mark Pollack, Oliver Gierke, Christoph Strobl, Jens Schauder
-
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.default StringensureIndex(IndexDefinition indexDefinition) Deprecated, for removal: This API element is subject to removal in a future version.Returns the index information on the collection.
-
Method Details
-
ensureIndex
@Deprecated(since="4.5", forRemoval=true) default String ensureIndex(IndexDefinition indexDefinition) Deprecated, for removal: This API element is subject to removal in a future version.since 4.5, in favor ofcreateIndex(IndexDefinition).Ensure that an index for the providedIndexDefinitionexists for the collection indicated by the entity class. If not it will be created.- Parameters:
indexDefinition- must not be null.- Returns:
- the index name.
-
createIndex
Create 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.- Parameters:
indexDefinition- must not be null.- Returns:
- the index name.
- Since:
- 4.5
-
alterIndex
Alters the index with given name.- Parameters:
name- name of index to change.options- index options.- Since:
- 4.1
-
dropIndex
Drops an index from this collection.- Parameters:
name- name of index to drop
-
dropAllIndexes
void dropAllIndexes()Drops all indices from this collection. -
getIndexInfo
Returns the index information on the collection.- Returns:
- index information on the collection
-
createIndex(IndexDefinition).