Annotation Interface IndexOptions


Defines the options to be used when declaring an index.
  • Element Details

    • background

      boolean background
      Returns:
      if true, create the index in the background
      Default:
      false
    • disableValidation

      boolean disableValidation
      Returns:
      if true, disables validation for the field name
      Default:
      false
    • expireAfterSeconds

      int expireAfterSeconds
      Returns:
      defines the time to live for documents in the collection
      Default:
      -1
    • language

      String language
      Returns:
      The default language for the index.
      Default:
      ""
    • languageOverride

      String languageOverride
      Returns:
      The field to use to override the default language.
      Default:
      ""
    • name

      String name
      Returns:
      The name of the index to create; default is to let the mongodb create a name (in the form of key1_1/-1_key2_1/-1...)
      Default:
      ""
    • sparse

      boolean sparse
      Returns:
      if true, create the index with the sparse option
      Default:
      false
    • unique

      boolean unique
      Returns:
      if true, creates the index as a unique value index; inserting duplicates values in this field will cause errors
      Default:
      false
    • partialFilter

      String partialFilter
      Returns:
      the filter to be used for this index
      Since:
      1.3
      Default:
      ""
    • collation

      Collation collation
      Returns:
      the collation to be used for this index. If the locale is empty, the collation is ignored.
      Since:
      1.3
      Default:
      @dev.morphia.annotations.Collation(locale="")