Class IndexOptions
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final booleanstatic final boolean -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorIndexOptions(JsonObject options) Constructor from JSONIndexOptions(IndexOptions options) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionbackground(boolean background) Should the index be created in the backgroundSets the number of precision of the stored geohash value of the location data in 2d indexes.defaultLanguage(String defaultLanguage) Sets the language for the text index.booleanexpireAfter(Long expireAfter, TimeUnit timeUnit) Sets the time to live for documents in the collectiongetBits()Gets the number of precision of the stored geohash value of the location data in 2d indexes.Gets the language for a text index.getExpireAfter(TimeUnit timeUnit) Gets the time to live for documents in the collectionGets the name of the field that contains the language string.getMax()Gets the upper inclusive boundary for the longitude and latitude values for 2d indexes..getMin()Gets the lower inclusive boundary for the longitude and latitude values for 2d indexes..getName()Gets the name of the index.Get the filter expression for the documents to be included in the index or null if not setGets the 2dsphere index version number.Gets the storage engine options document for this index.The text index version number.Gets the index version number.Gets the weighting object for use with a text indexinthashCode()booleanCreate the index in the backgroundbooleanisSparse()If true, the index only references documents with the specified fieldbooleanisUnique()Gets if the index should be unique.languageOverride(String languageOverride) Sets the name of the field that contains the language string.Sets the upper inclusive boundary for the longitude and latitude values for 2d indexes..Sets the lower inclusive boundary for the longitude and latitude values for 2d indexes..Sets the name of the index.partialFilterExpression(JsonObject partialFilterExpression) Sets the filter expression for the documents to be included in the indexsetCollation(CollationOptions collation) Optional.sparse(boolean sparse) Should the index only references documents with the specified fieldsphereVersion(Integer sphereVersion) Sets the 2dsphere index version number.storageEngine(JsonObject storageEngine) Sets the storage engine options document for this index.textVersion(Integer textVersion) Set the text index version number.toJson()Convert to JSONtoString()unique(boolean unique) Should the index should be unique.Sets the index version number.weights(JsonObject weights) Sets the weighting object for use with a text index.
-
Field Details
-
DEFAULT_BACKGROUND
public static final boolean DEFAULT_BACKGROUND- See Also:
-
DEFAULT_UNIQUE
public static final boolean DEFAULT_UNIQUE- See Also:
-
DEFAULT_SPARSE
public static final boolean DEFAULT_SPARSE- See Also:
-
-
Constructor Details
-
IndexOptions
public IndexOptions()Default constructor -
IndexOptions
-
IndexOptions
-
-
Method Details
-
getCollation
-
setCollation
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:
-
toJson
-
isBackground
public boolean isBackground()Create the index in the background- Returns:
- true if should create the index in the background
-
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
Should the index should be unique.- Parameters:
unique- if the index should be unique- Returns:
- reference to this, for fluency
-
getName
-
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
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
-
expireAfter
Sets the time to live for documents in the collection- Parameters:
expireAfter- the time to live for documents in the collectiontimeUnit- the time unit for expireAfter- Returns:
- reference to this, for fluency
-
getVersion
-
version
Sets the index version number.- Parameters:
version- the index version number- Returns:
- reference to this, for fluency
-
getWeights
Gets the weighting object for use with a text indexA 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
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
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
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
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
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
The text index version number.- Returns:
- the text index version number.
-
textVersion
Set the text index version number.- Parameters:
textVersion- the text index version number.- Returns:
- reference to this, for fluency
-
getSphereVersion
Gets the 2dsphere index version number.- Returns:
- the 2dsphere index version number
-
sphereVersion
Sets the 2dsphere index version number.- Parameters:
sphereVersion- the 2dsphere index version number.- Returns:
- reference to this, for fluency
-
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
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
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
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
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
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
Gets the storage engine options document for this index.- Returns:
- the storage engine options
-
storageEngine
Sets the storage engine options document for this index.- Parameters:
storageEngine- the storage engine options- Returns:
- reference to this, for fluency
-
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
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
-
hashCode
-
toString
-