Package org.kiwiproject.spring.data
Class KiwiMongoIndexes
java.lang.Object
org.kiwiproject.spring.data.KiwiMongoIndexes
Utilities related to Mongo indexes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidensureIndices(org.springframework.data.mongodb.core.MongoTemplate mongoTemplate, Class<?> clazz, org.springframework.data.domain.Sort.Direction direction, String... properties) Ensure indexes exist for the given collection (defined byclazz), sort direction, and properties.static voidensureIndices(org.springframework.data.mongodb.core.MongoTemplate mongoTemplate, String collectionName, org.springframework.data.domain.Sort.Direction direction, String... properties) Ensure indexes exist for the given collection, sort direction, and properties.
-
Method Details
-
ensureIndices
public static void ensureIndices(org.springframework.data.mongodb.core.MongoTemplate mongoTemplate, Class<?> clazz, org.springframework.data.domain.Sort.Direction direction, String... properties) Ensure indexes exist for the given collection (defined byclazz), sort direction, and properties.- Parameters:
mongoTemplate- the MongoTemplate instanceclazz- the entity/document class representing the mapped MongoDB collectiondirection- the sort direction for all specified propertiesproperties- the properties for which to add an index- See Also:
-
IndexOperations.ensureIndex(IndexDefinition)
-
ensureIndices
public static void ensureIndices(org.springframework.data.mongodb.core.MongoTemplate mongoTemplate, String collectionName, org.springframework.data.domain.Sort.Direction direction, String... properties) Ensure indexes exist for the given collection, sort direction, and properties.- Parameters:
mongoTemplate- the MongoTemplate instancecollectionName- the MongoDB collection namedirection- the sort direction for all specified propertiesproperties- the properties for which to add an index- See Also:
-
IndexOperations.ensureIndex(IndexDefinition)
-