public class CreateIndexOperation extends Object implements AsyncWriteOperation<Void>, WriteOperation<Void>
Constructor and Description |
---|
CreateIndexOperation(MongoNamespace namespace,
BsonDocument key)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
CreateIndexOperation |
background(boolean background)
s if the index should be created in the background
|
CreateIndexOperation |
bits(Integer bits)
Sets the number of precision of the stored geohash value of the location data in 2d indexes.
|
CreateIndexOperation |
bucketSize(Double bucketSize)
Sets the specified the number of units within which to group the location values for geoHaystack Indexes
|
CreateIndexOperation |
defaultLanguage(String defaultLanguage)
Sets the language for the text index.
|
CreateIndexOperation |
dropDups(boolean dropDups)
Sets the legacy dropDups setting
|
Void |
execute(WriteBinding binding)
General execute which can return anything of type T
|
void |
executeAsync(AsyncWriteBinding binding,
SingleResultCallback<Void> callback)
General execute which can return anything of type T
|
CreateIndexOperation |
expireAfterSeconds(Integer expireAfterSeconds)
s 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
|
String |
getDefaultLanguage()
Gets the language for a text index.
|
boolean |
getDropDups()
Returns the legacy dropDups setting
|
Integer |
getExpireAfterSeconds()
Gets the time to live for documents in the collection
|
BsonDocument |
getKey()
Gets the index key.
|
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.
|
BsonDocument |
getStorageEngineOptions()
Gets the storage engine options document for this index.
|
Integer |
getTextIndexVersion()
The text index version number.
|
Integer |
getTwoDSphereIndexVersion()
Gets the 2dsphere index version number.
|
Integer |
getVersion()
Gets the index version number.
|
BsonDocument |
getWeights()
Gets the weighting document for use with a text index
|
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.
|
CreateIndexOperation |
languageOverride(String languageOverride)
Sets the name of the field that contains the language string.
|
CreateIndexOperation |
max(Double max)
Sets the upper inclusive boundary for the longitude and latitude values for 2d indexes..
|
CreateIndexOperation |
min(Double min)
Sets the lower inclusive boundary for the longitude and latitude values for 2d indexes..
|
CreateIndexOperation |
name(String name)
Sets the name of the index.
|
CreateIndexOperation |
sparse(boolean sparse)
Should the index only references documents with the specified field
|
CreateIndexOperation |
storageEngineOptions(BsonDocument storageEngineOptions)
Sets the storage engine options document for this index.
|
CreateIndexOperation |
textIndexVersion(Integer textIndexVersion)
Set the text index version number.
|
CreateIndexOperation |
twoDSphereIndexVersion(Integer sphereIndexVersion)
Sets the 2dsphere index version number.
|
CreateIndexOperation |
unique(boolean unique)
s if the index should be unique.
|
CreateIndexOperation |
version(Integer version)
Sets the index version number.
|
CreateIndexOperation |
weights(BsonDocument weights)
Sets the weighting document for use with a text index.
|
public CreateIndexOperation(MongoNamespace namespace, BsonDocument key)
namespace
- the database and collection namespace for the operation.key
- the index key.public BsonDocument getKey()
public boolean isBackground()
public CreateIndexOperation background(boolean background)
background
- true if should create the index in the backgroundpublic boolean isUnique()
public CreateIndexOperation unique(boolean unique)
unique
- if the index should be uniquepublic String getName()
public CreateIndexOperation name(String name)
name
- of the indexpublic boolean isSparse()
public CreateIndexOperation sparse(boolean sparse)
sparse
- if true, the index only references documents with the specified fieldpublic Integer getExpireAfterSeconds()
public CreateIndexOperation expireAfterSeconds(Integer expireAfterSeconds)
expireAfterSeconds
- the time to live for documents in the collectionpublic Integer getVersion()
public CreateIndexOperation version(Integer version)
version
- the index version numberpublic BsonDocument 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 CreateIndexOperation weights(BsonDocument weights)
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.
weights
- the weighting documentpublic String getDefaultLanguage()
The language that determines the list of stop words and the rules for the stemmer and tokenizer.
public CreateIndexOperation 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 CreateIndexOperation 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 getTextIndexVersion()
public CreateIndexOperation textIndexVersion(Integer textIndexVersion)
textIndexVersion
- the text index version number.public Integer getTwoDSphereIndexVersion()
public CreateIndexOperation twoDSphereIndexVersion(Integer sphereIndexVersion)
sphereIndexVersion
- the 2dsphere index version number.public Integer getBits()
public CreateIndexOperation bits(Integer bits)
bits
- the number of precision of the stored geohash valuepublic Double getMin()
public CreateIndexOperation min(Double min)
min
- the lower inclusive boundary for the longitude and latitude valuespublic Double getMax()
public CreateIndexOperation max(Double max)
max
- the upper inclusive boundary for the longitude and latitude valuespublic Double getBucketSize()
public CreateIndexOperation bucketSize(Double bucketSize)
bucketSize
- the specified the number of units within which to group the location values for geoHaystack Indexespublic boolean getDropDups()
Prior to MongoDB 3.0 dropDups could be used with unique indexes allowing documents with duplicate values to be dropped when building the index. Later versions of MongoDB will silently ignore this setting.
public CreateIndexOperation dropDups(boolean dropDups)
Prior to MongoDB 3.0 dropDups could be used with unique indexes allowing documents with duplicate values to be dropped when building the index. Later versions of MongoDB will silently ignore this setting.
dropDups
- the legacy dropDups settingpublic BsonDocument getStorageEngineOptions()
public CreateIndexOperation storageEngineOptions(BsonDocument storageEngineOptions)
storageEngineOptions
- the storate engine optionspublic Void execute(WriteBinding binding)
WriteOperation
execute
in interface WriteOperation<Void>
binding
- the binding to execute in the context ofpublic void executeAsync(AsyncWriteBinding binding, SingleResultCallback<Void> callback)
AsyncWriteOperation
executeAsync
in interface AsyncWriteOperation<Void>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed