Class KiwiMongoIndexes

java.lang.Object
org.kiwiproject.spring.data.KiwiMongoIndexes

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

    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 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)