Annotation Type IndexOptions


  • @Documented
    @Inherited
    @Retention(RUNTIME)
    @Target(ANNOTATION_TYPE)
    public @interface IndexOptions
    Defines the options to be used when declaring an index.
    • Element Detail

      • 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
      • dropDups

        @Deprecated
        boolean dropDups
        Deprecated.
        Support for this has been removed from the server. This value is ignored.
        Returns:
        if true, tells the unique index to drop duplicates silently when creating; only the first will be kept
        Default:
        false
      • expireAfterSeconds

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

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

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

        java.lang.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

        java.lang.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
        Since:
        1.3
        Default:
        @dev.morphia.annotations.Collation(locale="")