public class IndexOptions extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_BACKGROUND |
static boolean |
DEFAULT_SPARSE |
static boolean |
DEFAULT_UNIQUE |
Constructor and Description |
---|
IndexOptions()
Default constructor
|
IndexOptions(IndexOptions options)
Copy constructor
|
IndexOptions(JsonObject options)
Constructor from JSON
|
Modifier and Type | Method and 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 |
bucketSize(Double bucketSize)
Sets the specified the number of units within which to group the location values for geoHaystack 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.
|
Double |
getBucketSize()
Gets the specified the number of units within which to group the location values for geoHaystack 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.
|
public static final boolean DEFAULT_BACKGROUND
public static final boolean DEFAULT_UNIQUE
public static final boolean DEFAULT_SPARSE
public IndexOptions()
public IndexOptions(IndexOptions options)
options
- the one to copypublic IndexOptions(JsonObject options)
options
- the JSONpublic CollationOptions getCollation()
public IndexOptions setCollation(CollationOptions collation)
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.
collation
- as CollationOptionpublic JsonObject toJson()
public boolean isBackground()
public IndexOptions background(boolean background)
background
- true if should create the index in the backgroundpublic boolean isUnique()
public IndexOptions unique(boolean unique)
unique
- if the index should be uniquepublic String getName()
public IndexOptions name(String name)
name
- of the indexpublic boolean isSparse()
public IndexOptions sparse(boolean sparse)
sparse
- if true, the index only references documents with the specified fieldpublic Long getExpireAfter(TimeUnit timeUnit)
timeUnit
- the time unitpublic IndexOptions expireAfter(Long expireAfter, TimeUnit timeUnit)
expireAfter
- the time to live for documents in the collectiontimeUnit
- the time unit for expireAfterpublic Integer getVersion()
public IndexOptions version(Integer version)
version
- the index version numberpublic JsonObject getWeights()
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.
public IndexOptions weights(JsonObject weights)
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.
weights
- the weighting objectpublic String getDefaultLanguage()
The language that determines the list of stop words and the rules for the stemmer and tokenizer.
public IndexOptions defaultLanguage(String defaultLanguage)
The language that determines the list of stop words and the rules for the stemmer and tokenizer.
defaultLanguage
- the language for the text index.public String getLanguageOverride()
For text indexes, the name of the field, in the collection's documents, that contains the override language for the document.
public IndexOptions languageOverride(String languageOverride)
For text indexes, the name of the field, in the collection's documents, that contains the override language for the document.
languageOverride
- the name of the field that contains the language string.public Integer getTextVersion()
public IndexOptions textVersion(Integer textVersion)
textVersion
- the text index version number.public Integer getSphereVersion()
public IndexOptions sphereVersion(Integer sphereVersion)
sphereVersion
- the 2dsphere index version number.public Integer getBits()
public IndexOptions bits(Integer bits)
bits
- the number of precision of the stored geohash valuepublic Double getMin()
public IndexOptions min(Double min)
min
- the lower inclusive boundary for the longitude and latitude valuespublic Double getMax()
public IndexOptions max(Double max)
max
- the upper inclusive boundary for the longitude and latitude valuespublic Double getBucketSize()
public IndexOptions bucketSize(Double bucketSize)
bucketSize
- the specified the number of units within which to group the location values for geoHaystack Indexespublic JsonObject getStorageEngine()
public IndexOptions storageEngine(JsonObject storageEngine)
storageEngine
- the storage engine optionspublic JsonObject getPartialFilterExpression()
public IndexOptions partialFilterExpression(JsonObject partialFilterExpression)
partialFilterExpression
- the filter expression for the documents to be included in the indexCopyright © 2024 Eclipse. All rights reserved.