Class IndexOptions
- Since:
- 3.0
- MongoDB documentation
- Index options
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbackground
(boolean background) Should the index should be created in the backgroundSets the number of precision of the stored geohash value of the location data in 2d indexes.Sets the collation optionsdefaultLanguage
(String defaultLanguage) Sets the language for the text index.expireAfter
(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.Returns the collation optionsGets 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 indexGets the wildcard projection of a wildcard indexhidden
(boolean hidden) Should the index not be used by the query planner when executing operations.boolean
Create the index in the backgroundboolean
isHidden()
Gets whether the index should not be used by the query planner when executing operations.boolean
isSparse()
If true, the index only references documents with the specified fieldboolean
isUnique()
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
(Bson partialFilterExpression) Sets the filter expression for the documents to be included in the indexsparse
(boolean sparse) Should the index only references documents with the specified fieldsphereVersion
(Integer sphereVersion) Sets the 2dsphere index version number.storageEngine
(Bson storageEngine) Sets the storage engine options document for this index.textVersion
(Integer textVersion) Set the text index version number.toString()
unique
(boolean unique) Should the index should be unique.Sets the index version number.Sets the weighting object for use with a text index.wildcardProjection
(Bson wildcardProjection) Sets the wildcard projection of a wildcard index
-
Constructor Details
-
IndexOptions
public IndexOptions()
-
-
Method Details
-
isBackground
public boolean isBackground()Create the index in the background- Returns:
- true if should create the index in the background
-
background
Should the index should be created in the background- Parameters:
background
- true if should create the index in the background- Returns:
- this
-
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:
- this
-
getName
Gets the name of the index.- Returns:
- the name of the index
-
name
Sets the name of the index.- Parameters:
name
- of the index- Returns:
- this
-
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:
- this
-
getExpireAfter
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
- MongoDB documentation
- TTL
-
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:
- this
- MongoDB documentation
- TTL
-
getVersion
Gets the index version number.- Returns:
- the index version number
-
version
Sets the index version number.- Parameters:
version
- the index version number- Returns:
- this
-
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
- MongoDB documentation
- Control Search Results with Weights
-
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:
- this
- MongoDB documentation
- Control Search Results with Weights
-
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.
- MongoDB documentation
- Text Search languages
-
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:
- this
- MongoDB documentation
- Text Search languages
-
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.
- MongoDB documentation
- Language override
-
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:
- this
- MongoDB documentation
- Language override
-
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:
- this
-
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:
- this
-
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:
- this
-
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:
- this
-
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:
- this
-
getStorageEngine
Gets the storage engine options document for this index.- Returns:
- the storage engine options
- Since server release
- 3.0
-
storageEngine
Sets the storage engine options document for this index.- Parameters:
storageEngine
- the storage engine options- Returns:
- this
- Since server release
- 3.0
-
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
- Since:
- 3.2
- Since server release
- 3.2
-
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:
- this
- Since:
- 3.2
- Since server release
- 3.2
-
getCollation
Returns the collation options- Returns:
- the collation options
- Since:
- 3.4
- Since server release
- 3.4
-
collation
Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
- Since:
- 3.4
- Since server release
- 3.4
-
getWildcardProjection
Gets the wildcard projection of a wildcard index- Returns:
- the wildcard projection
- Since:
- 3.10
- Since server release
- 4.2
-
wildcardProjection
Sets the wildcard projection of a wildcard index- Parameters:
wildcardProjection
- the wildcard projection- Returns:
- this
- Since:
- 3.10
- Since server release
- 4.2
-
isHidden
public boolean isHidden()Gets whether the index should not be used by the query planner when executing operations.- Returns:
- true if the index should not be used by the query planner when executing operations.
- Since:
- 4.1
- Since server release
- 4.4
-
toString
-