java.lang.Object
org.springframework.data.mongodb.core.index.IndexInfo

public class IndexInfo extends Object
Index information for a MongoDB index.
Author:
Mark Pollack, Oliver Gierke, Christoph Strobl, Mark Paluch
  • Constructor Details

    • IndexInfo

      public IndexInfo(List<IndexField> indexFields, String name, boolean unique, boolean sparse, String language)
    • IndexInfo

      public IndexInfo(List<IndexField> indexFields, String name, boolean unique, boolean sparse, String language, boolean hidden)
  • Method Details

    • indexInfoOf

      public static IndexInfo indexInfoOf(org.bson.Document sourceDocument)
      Creates new IndexInfo parsing required properties from the given sourceDocument.
      Parameters:
      sourceDocument - never null.
      Returns:
      new instance of IndexInfo.
      Since:
      1.10
    • getIndexFields

      public List<IndexField> getIndexFields()
      Returns the individual index fields of the index.
      Returns:
    • isIndexForFields

      public boolean isIndexForFields(Collection<String> keys)
      Returns whether the index is covering exactly the fields given independently of the order.
      Parameters:
      keys - must not be null.
      Returns:
    • getName

      public String getName()
    • isUnique

      public boolean isUnique()
    • isSparse

      public boolean isSparse()
    • getLanguage

      public String getLanguage()
      Returns:
      Since:
      1.6
    • getPartialFilterExpression

      @Nullable public String getPartialFilterExpression()
      Returns:
      Since:
      1.0
    • getCollation

      public Optional<org.bson.Document> getCollation()
      Get collation information.
      Returns:
      Since:
      2.0
    • getWildcardProjection

      public Optional<org.bson.Document> getWildcardProjection()
      Get wildcardProjection information.
      Returns:
      empty if not set.
      Since:
      3.3
    • getExpireAfter

      public Optional<Duration> getExpireAfter()
      Get the duration after which documents within the index expire.
      Returns:
      the expiration time if set, Optional.empty() otherwise.
      Since:
      2.2
    • isHashed

      public boolean isHashed()
      Returns:
      true if a hashed index field is present.
      Since:
      2.2
    • isWildcard

      public boolean isWildcard()
      Returns:
      true if a wildcard index field is present.
      Since:
      3.3
    • isHidden

      public boolean isHidden()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object