Table of Contents

Class IndexOptions

Namespace
MongoDB.Driver.Builders
Assembly
MongoDB.Driver.Legacy.dll

A builder for the options used when creating an index.

public static class IndexOptions
Inheritance
IndexOptions
Inherited Members

Properties

Null

Gets a null value with a type of IMongoIndexOptions.

public static IMongoIndexOptions Null { get; }

Property Value

IMongoIndexOptions

Methods

SetBackground(bool)

Sets whether to build the index in the background.

public static IndexOptionsBuilder SetBackground(bool value)

Parameters

value bool

Whether 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 static IndexOptionsBuilder SetBits(int value)

Parameters

value int

The 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 static IndexOptionsBuilder SetBucketSize(double value)

Parameters

value double

The bucket size.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).

SetDropDups(bool)

Sets whether duplicates should be dropped.

public static IndexOptionsBuilder SetDropDups(bool value)

Parameters

value bool

Whether duplicates should be dropped.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).

SetGeoSpatialRange(double, double)

Sets the geospatial range.

public static IndexOptionsBuilder SetGeoSpatialRange(double min, double max)

Parameters

min double

The min value of the range.

max double

The max value of the range.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).

SetHidden(bool)

Sets whether the index is hidden.

public static IndexOptionsBuilder SetHidden(bool value)

Parameters

value bool

Whether the index is hidden.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).

SetName(string)

Sets the name of the index.

public static IndexOptionsBuilder SetName(string value)

Parameters

value string

The name of the index.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).

SetPartialFilterExpression(IMongoQuery)

Sets the partial filter expression.

public static IndexOptionsBuilder SetPartialFilterExpression(IMongoQuery value)

Parameters

value IMongoQuery

The value.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).

SetSparse(bool)

Sets whether the index is a sparse index.

public static IndexOptionsBuilder SetSparse(bool value)

Parameters

value bool

Whether the index is a sparse index.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).

SetStorageEngineOptions(BsonDocument)

Sets the storage engine options.

public static IndexOptionsBuilder SetStorageEngineOptions(BsonDocument value)

Parameters

value BsonDocument

The value.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).

SetTextDefaultLanguage(string)

Sets the default language for the text index.

public static IndexOptionsBuilder SetTextDefaultLanguage(string language)

Parameters

language string

The 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 static IndexOptionsBuilder SetTextLanguageOverride(string fieldName)

Parameters

fieldName string

The field name.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).

SetTimeToLive(TimeSpan)

Sets the time to live value.

public static IndexOptionsBuilder SetTimeToLive(TimeSpan timeToLive)

Parameters

timeToLive TimeSpan

The time to live.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).

SetUnique(bool)

Sets whether the index enforces unique values.

public static IndexOptionsBuilder SetUnique(bool value)

Parameters

value bool

Whether 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 static IndexOptionsBuilder SetWeight(string name, int value)

Parameters

name string

The name of the field.

value int

The weight.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).

SetWildcardProjection(string, bool)

Sets the wildcardProjection for the index.

public static IndexOptionsBuilder SetWildcardProjection(string name, bool included)

Parameters

name string

The field name.

included bool

The flag determines whether the field should be included or excluded from wildcard projecting.

Returns

IndexOptionsBuilder

The builder (so method calls can be chained).