Class IndexOptions

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

public class IndexOptions extends Object
Changeable properties of an index. Can be used for index creation and modification.
Since:
4.1
Author:
Christoph Strobl
  • Constructor Details

    • IndexOptions

      public IndexOptions()
  • Method Details

    • none

      public static IndexOptions none()
      Returns:
      new empty instance of IndexOptions.
    • unique

      public static IndexOptions unique()
      Returns:
      new instance of IndexOptions having the IndexOptions.Unique.YES flag set.
    • hidden

      public static IndexOptions hidden()
      Returns:
      new instance of IndexOptions having the hidden flag set.
    • expireAfter

      public static IndexOptions expireAfter(Duration duration)
      Returns:
      new instance of IndexOptions with given expiration.
    • getExpire

      public Duration getExpire()
      Returns:
      the expiration time. A negative value represents no expiration, null if not set.
    • setExpire

      public void setExpire(Duration expire)
      Parameters:
      expire - must not be null.
    • isHidden

      @Nullable public Boolean isHidden()
      Returns:
      true if hidden, null if not set.
    • setHidden

      public void setHidden(boolean hidden)
      Parameters:
      hidden -
    • getUnique

      @Nullable public IndexOptions.Unique getUnique()
      Returns:
      the unique property value, null if not set.
    • setUnique

      public void setUnique(IndexOptions.Unique unique)
      Parameters:
      unique - must not be null.
    • toDocument

      public org.bson.Document toDocument()
      Returns:
      the store native representation