Class IndexOptionsBuilder
A builder for the options used when creating an index.
[Serializable]
[BsonSerializer(typeof(IndexOptionsBuilder.Serializer))]
public class IndexOptionsBuilder : BuilderBase, IConvertibleToBsonDocument, IMongoIndexOptions
- Inheritance
-
IndexOptionsBuilder
- Implements
- Inherited Members
- Extension Methods
Constructors
IndexOptionsBuilder()
Initializes a new instance of the IndexOptionsBuilder class.
public IndexOptionsBuilder()
Methods
SetBackground(bool)
Sets whether to build the index in the background.
public IndexOptionsBuilder SetBackground(bool value)
Parameters
valueboolWhether to build the index in the background.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetBits(int)
Sets the location precision bits.
public IndexOptionsBuilder SetBits(int value)
Parameters
valueintThe value.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetBucketSize(double)
Sets the bucket size for geospatial haystack indexes.
[Obsolete("GeoHaystack indexes were deprecated in server version 4.4.")]
public IndexOptionsBuilder SetBucketSize(double value)
Parameters
valuedoubleThe bucket size.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetDropDups(bool)
Sets whether duplicates should be dropped.
public IndexOptionsBuilder SetDropDups(bool value)
Parameters
valueboolWhether duplicates should be dropped.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetGeoSpatialRange(double, double)
Sets the geospatial range.
public IndexOptionsBuilder SetGeoSpatialRange(double min, double max)
Parameters
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetHidden(bool)
Sets whether the index is hidden.
public IndexOptionsBuilder SetHidden(bool value)
Parameters
valueboolWhether the index is hidden.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetName(string)
Sets the name of the index.
public IndexOptionsBuilder SetName(string value)
Parameters
valuestringThe name of the index.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetPartialFilterExpression(IMongoQuery)
Sets the partial filter expression.
public IndexOptionsBuilder SetPartialFilterExpression(IMongoQuery value)
Parameters
valueIMongoQueryThe value.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetSparse(bool)
Sets whether the index is a sparse index.
public IndexOptionsBuilder SetSparse(bool value)
Parameters
valueboolWhether the index is a sparse index.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetStorageEngineOptions(BsonDocument)
Sets the storage engine options.
public IndexOptionsBuilder SetStorageEngineOptions(BsonDocument value)
Parameters
valueBsonDocumentThe value.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetTextDefaultLanguage(string)
Sets the default language for the text index.
public IndexOptionsBuilder SetTextDefaultLanguage(string language)
Parameters
languagestringThe default language.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetTextLanguageOverride(string)
Specifies the field name containing the language for the text index.
public IndexOptionsBuilder SetTextLanguageOverride(string fieldName)
Parameters
fieldNamestringThe field name.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetTimeToLive(TimeSpan)
Sets the time to live value.
public IndexOptionsBuilder SetTimeToLive(TimeSpan timeToLive)
Parameters
timeToLiveTimeSpanThe time to live.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetUnique(bool)
Sets whether the index enforces unique values.
public IndexOptionsBuilder SetUnique(bool value)
Parameters
valueboolWhether the index enforces unique values.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetWeight(string, int)
Sets the weight of a field for the text index.
public IndexOptionsBuilder SetWeight(string name, int value)
Parameters
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
SetWildcardProjection(string, bool)
Sets the wildcardProjection for the index.
public IndexOptionsBuilder SetWildcardProjection(string name, bool included)
Parameters
namestringThe field name.
includedboolThe flag determines whether the field should be included or excluded from wildcard projecting.
Returns
- IndexOptionsBuilder
The builder (so method calls can be chained).
ToBsonDocument()
Returns the result of the builder as a BsonDocument.
public override BsonDocument ToBsonDocument()
Returns
- BsonDocument
A BsonDocument.