Package io.vertx.ext.mongo

## Class IndexOptions

- java.lang.Object
- - io.vertx.ext.mongo.IndexOptions

-     public class IndexOptions
      extends Object

  Options used to configure index.
  Author:
    Ruslan Sennov

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static boolean` | `DEFAULT_BACKGROUND` |
    `static boolean` | `DEFAULT_SPARSE` |
    `static boolean` | `DEFAULT_UNIQUE` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `IndexOptions()` | Default constructor
    `IndexOptions​(JsonObject options)` | Constructor from JSON
    `IndexOptions​(IndexOptions options)` | Copy constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `IndexOptions` | `background​(boolean background)` | Should the index be created in the background
    `IndexOptions` | `bits​(Integer bits)` | Sets the number of precision of the stored geohash value of the location data in 2d indexes.
    `IndexOptions` | `defaultLanguage​(String defaultLanguage)` | Sets the language for the text index.
    `boolean` | `equals​(Object o)` |
    `IndexOptions` | `expireAfter​(Long expireAfter, TimeUnit timeUnit)` | Sets the time to live for documents in the collection
    `Integer` | `getBits()` | Gets the number of precision of the stored geohash value of the location data in 2d indexes.
    `CollationOptions` | `getCollation()` |
    `String` | `getDefaultLanguage()` | Gets the language for a text index.
    `Long` | `getExpireAfter​(TimeUnit timeUnit)` | Gets the time to live for documents in the collection
    `String` | `getLanguageOverride()` | Gets the name of the field that contains the language string.
    `Double` | `getMax()` | Gets the upper inclusive boundary for the longitude and latitude values for 2d indexes..
    `Double` | `getMin()` | Gets the lower inclusive boundary for the longitude and latitude values for 2d indexes..
    `String` | `getName()` | Gets the name of the index.
    `JsonObject` | `getPartialFilterExpression()` | Get the filter expression for the documents to be included in the index or null if not set
    `Integer` | `getSphereVersion()` | Gets the 2dsphere index version number.
    `JsonObject` | `getStorageEngine()` | Gets the storage engine options document for this index.
    `Integer` | `getTextVersion()` | The text index version number.
    `Integer` | `getVersion()` | Gets the index version number.
    `JsonObject` | `getWeights()` | Gets the weighting object for use with a text index
    `int` | `hashCode()` |
    `boolean` | `isBackground()` | Create the index in the background
    `boolean` | `isSparse()` | If true, the index only references documents with the specified field
    `boolean` | `isUnique()` | Gets if the index should be unique.
    `IndexOptions` | `languageOverride​(String languageOverride)` | Sets the name of the field that contains the language string.
    `IndexOptions` | `max​(Double max)` | Sets the upper inclusive boundary for the longitude and latitude values for 2d indexes..
    `IndexOptions` | `min​(Double min)` | Sets the lower inclusive boundary for the longitude and latitude values for 2d indexes..
    `IndexOptions` | `name​(String name)` | Sets the name of the index.
    `IndexOptions` | `partialFilterExpression​(JsonObject partialFilterExpression)` | Sets the filter expression for the documents to be included in the index
    `IndexOptions` | `setCollation​(CollationOptions collation)` | Optional.
    `IndexOptions` | `sparse​(boolean sparse)` | Should the index only references documents with the specified field
    `IndexOptions` | `sphereVersion​(Integer sphereVersion)` | Sets the 2dsphere index version number.
    `IndexOptions` | `storageEngine​(JsonObject storageEngine)` | Sets the storage engine options document for this index.
    `IndexOptions` | `textVersion​(Integer textVersion)` | Set the text index version number.
    `JsonObject` | `toJson()` | Convert to JSON
    `String` | `toString()` |
    `IndexOptions` | `unique​(boolean unique)` | Should the index should be unique.
    `IndexOptions` | `version​(Integer version)` | Sets the index version number.
    `IndexOptions` | `weights​(JsonObject weights)` | Sets the weighting object for use with a text index.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_BACKGROUND

          public static final boolean DEFAULT_BACKGROUND

      See Also:
        Constant Field Values

    - #### DEFAULT_UNIQUE

          public static final boolean DEFAULT_UNIQUE

      See Also:
        Constant Field Values

    - #### DEFAULT_SPARSE

          public static final boolean DEFAULT_SPARSE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### IndexOptions

          public IndexOptions()

      Default constructor

    - #### IndexOptions

          public IndexOptions​(IndexOptions options)

      Copy constructor
      Parameters:
        `options` - the one to copy

    - #### IndexOptions

          public IndexOptions​(JsonObject options)

      Constructor from JSON
      Parameters:
        `options` - the JSON

  - ### Method Detail

    - #### getCollation

          public CollationOptions getCollation()

    - #### setCollation

          public IndexOptions setCollation​(CollationOptions collation)

      Optional. Specifies the collation for the index.

      Collation allows users to specify language-specific rules for string comparison, such as rules for lettercase and accent marks.

      If you have specified a collation at the collection level, then: If you do not specify a collation when creating the index, MongoDB creates the index with the collection's default collation. If you do specify a collation when creating the index, MongoDB creates the index with the specified collation. When specifying collation, the locale field is mandatory; all other collation fields are optional. For descriptions of the fields, see Collation Document.

      Parameters:
        `collation` - as CollationOption
      Returns:
        IndexOptions
      See Also:
        Collation Document

    - #### toJson

          public JsonObject toJson()

      Convert to JSON
      Returns:
        the JSON

    - #### isBackground

          public boolean isBackground()

      Create the index in the background
      Returns:
        true if should create the index in the background

    - #### background

          public IndexOptions background​(boolean background)

      Should the index be created in the background
      Parameters:
        `background` - true if should create the index in the background
      Returns:
        reference to this, for fluency

    - #### isUnique

          public boolean isUnique()

      Gets if the index should be unique.
      Returns:
        true if the index should be unique

    - #### unique

          public IndexOptions unique​(boolean unique)

      Should the index should be unique.
      Parameters:
        `unique` - if the index should be unique
      Returns:
        reference to this, for fluency

    - #### getName

          public String getName()

      Gets the name of the index.
      Returns:
        the name of the index

    - #### name

          public IndexOptions name​(String name)

      Sets the name of the index.
      Parameters:
        `name` - of the index
      Returns:
        reference to this, for fluency

    - #### isSparse

          public boolean isSparse()

      If true, the index only references documents with the specified field
      Returns:
        if the index should only reference documents with the specified field

    - #### sparse

          public IndexOptions sparse​(boolean sparse)

      Should the index only references documents with the specified field
      Parameters:
        `sparse` - if true, the index only references documents with the specified field
      Returns:
        reference to this, for fluency

    - #### getExpireAfter

          public Long getExpireAfter​(TimeUnit timeUnit)

      Gets the time to live for documents in the collection
      Parameters:
        `timeUnit` - the time unit
      Returns:
        the time to live for documents in the collection

    - #### expireAfter

          public IndexOptions expireAfter​(Long expireAfter,
                                          TimeUnit timeUnit)

      Sets the time to live for documents in the collection
      Parameters:
        `expireAfter` - the time to live for documents in the collection
        `timeUnit` - the time unit for expireAfter
      Returns:
        reference to this, for fluency

    - #### getVersion

          public Integer getVersion()

      Gets the index version number.
      Returns:
        the index version number

    - #### version

          public IndexOptions version​(Integer version)

      Sets the index version number.
      Parameters:
        `version` - the index version number
      Returns:
        reference to this, for fluency

    - #### getWeights

          public JsonObject getWeights()

      Gets the weighting object for use with a text index

      A document that represents field and weight pairs. The weight is an integer ranging from 1 to 99,999 and denotes the significance of the field relative to the other indexed fields in terms of the score.

      Returns:
        the weighting object

    - #### weights

          public IndexOptions weights​(JsonObject weights)

      Sets the weighting object for use with a text index.

      An document that represents field and weight pairs. The weight is an integer ranging from 1 to 99,999 and denotes the significance of the field relative to the other indexed fields in terms of the score.

      Parameters:
        `weights` - the weighting object
      Returns:
        reference to this, for fluency

    - #### getDefaultLanguage

          public String getDefaultLanguage()

      Gets the language for a text index.

      The language that determines the list of stop words and the rules for the stemmer and tokenizer.

      Returns:
        the language for a text index.

    - #### defaultLanguage

          public IndexOptions defaultLanguage​(String defaultLanguage)

      Sets the language for the text index.

      The language that determines the list of stop words and the rules for the stemmer and tokenizer.

      Parameters:
        `defaultLanguage` - the language for the text index.
      Returns:
        reference to this, for fluency

    - #### getLanguageOverride

          public String getLanguageOverride()

      Gets the name of the field that contains the language string.

      For text indexes, the name of the field, in the collection's documents, that contains the override language for the document.

      Returns:
        the name of the field that contains the language string.

    - #### languageOverride

          public IndexOptions languageOverride​(String languageOverride)

      Sets the name of the field that contains the language string.

      For text indexes, the name of the field, in the collection's documents, that contains the override language for the document.

      Parameters:
        `languageOverride` - the name of the field that contains the language string.
      Returns:
        reference to this, for fluency

    - #### getTextVersion

          public Integer getTextVersion()

      The text index version number.
      Returns:
        the text index version number.

    - #### textVersion

          public IndexOptions textVersion​(Integer textVersion)

      Set the text index version number.
      Parameters:
        `textVersion` - the text index version number.
      Returns:
        reference to this, for fluency

    - #### getSphereVersion

          public Integer getSphereVersion()

      Gets the 2dsphere index version number.
      Returns:
        the 2dsphere index version number

    - #### sphereVersion

          public IndexOptions sphereVersion​(Integer sphereVersion)

      Sets the 2dsphere index version number.
      Parameters:
        `sphereVersion` - the 2dsphere index version number.
      Returns:
        reference to this, for fluency

    - #### getBits

          public Integer getBits()

      Gets the number of precision of the stored geohash value of the location data in 2d indexes.
      Returns:
        the number of precision of the stored geohash value

    - #### bits

          public IndexOptions bits​(Integer bits)

      Sets the number of precision of the stored geohash value of the location data in 2d indexes.
      Parameters:
        `bits` - the number of precision of the stored geohash value
      Returns:
        reference to this, for fluency

    - #### getMin

          public Double getMin()

      Gets the lower inclusive boundary for the longitude and latitude values for 2d indexes..
      Returns:
        the lower inclusive boundary for the longitude and latitude values.

    - #### min

          public IndexOptions min​(Double min)

      Sets the lower inclusive boundary for the longitude and latitude values for 2d indexes..
      Parameters:
        `min` - the lower inclusive boundary for the longitude and latitude values
      Returns:
        reference to this, for fluency

    - #### getMax

          public Double getMax()

      Gets the upper inclusive boundary for the longitude and latitude values for 2d indexes..
      Returns:
        the upper inclusive boundary for the longitude and latitude values.

    - #### max

          public IndexOptions max​(Double max)

      Sets the upper inclusive boundary for the longitude and latitude values for 2d indexes..
      Parameters:
        `max` - the upper inclusive boundary for the longitude and latitude values
      Returns:
        reference to this, for fluency

    - #### getStorageEngine

          public JsonObject getStorageEngine()

      Gets the storage engine options document for this index.
      Returns:
        the storage engine options

    - #### storageEngine

          public IndexOptions storageEngine​(JsonObject storageEngine)

      Sets the storage engine options document for this index.
      Parameters:
        `storageEngine` - the storage engine options
      Returns:
        reference to this, for fluency

    - #### getPartialFilterExpression

          public JsonObject getPartialFilterExpression()

      Get the filter expression for the documents to be included in the index or null if not set
      Returns:
        the filter expression for the documents to be included in the index or null if not set

    - #### partialFilterExpression

          public IndexOptions partialFilterExpression​(JsonObject partialFilterExpression)

      Sets the filter expression for the documents to be included in the index
      Parameters:
        `partialFilterExpression` - the filter expression for the documents to be included in the index
      Returns:
        reference to this, for fluency

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`