Class KiwiMongoIndexes


  • public class KiwiMongoIndexes
    extends Object
    Utilities related to Mongo indexes.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      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 by clazz), sort direction, and properties.
      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.
    • Constructor Detail

      • KiwiMongoIndexes

        public KiwiMongoIndexes()
    • Method Detail

      • 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 by clazz), sort direction, and properties.
        Parameters:
        mongoTemplate - the MongoTemplate instance
        clazz - the entity/document class representing the mapped MongoDB collection
        direction - the sort direction for all specified properties
        properties - 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 instance
        collectionName - the MongoDB collection name
        direction - the sort direction for all specified properties
        properties - the properties for which to add an index
        See Also:
        IndexOperations.ensureIndex(IndexDefinition)