Annotation Type Index


  • @Documented
    @Inherited
    @Retention(RUNTIME)
    @Target(ANNOTATION_TYPE)
    public @interface Index
    Defines an index
    Author:
    Scott Hernandez
    • Element Detail

      • fields

        Field[] fields
        Returns:
        List of fields to include in the index. At least one field must be defined unless defining a text index. Use of this field implies use of options() and any options defined directly on this annotation will be ignored.
        Default:
        {}
      • options

        IndexOptions options
        Returns:
        Options to apply to the index. Use of this field will ignore any of the deprecated options defined on Index directly.
        Default:
        @dev.morphia.annotations.IndexOptions
      • background

        @Deprecated
        boolean background
        Deprecated.
        use the IndexOptions found in options()
        Returns:
        if true, create the index in the background
        Default:
        false
      • disableValidation

        @Deprecated
        boolean disableValidation
        Deprecated.
        use the IndexOptions found in options()
        Returns:
        if true, disables validation for the field name
        Default:
        false
      • dropDups

        @Deprecated
        boolean dropDups
        Deprecated.
        this functionality is no longer supported on the server
        Returns:
        if true, tells the unique index to drop duplicates silently when creating; only the first will be kept
        Default:
        false
      • expireAfterSeconds

        @Deprecated
        int expireAfterSeconds
        Deprecated.
        use the IndexOptions found in options()
        Returns:
        the time to live for documents in the collection
        Default:
        -1
      • name

        @Deprecated
        java.lang.String name
        Deprecated.
        use the IndexOptions found in options()
        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

        @Deprecated
        boolean sparse
        Deprecated.
        use the IndexOptions found in options()
        Returns:
        if true, create the index with the sparse option
        Default:
        false
      • unique

        @Deprecated
        boolean unique
        Deprecated.
        use the IndexOptions found in options()
        Returns:
        if true, creates the index as a unique value index; inserting duplicates values in this field will cause errors
        Default:
        false
      • value

        @Deprecated
        java.lang.String value
        Deprecated.
        Returns:
        List of fields (prepended with "-" for desc; defaults to asc). If a value is defined for fields() this value will be ignored and logged.
        Default:
        ""