Table of Contents

Class IndexKeysBuilder<TDocument>

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

A builder for specifying the keys for an index.

[Serializable]
[BsonSerializer(typeof(IndexKeysBuilder<>.Serializer))]
public class IndexKeysBuilder<TDocument> : BuilderBase, IConvertibleToBsonDocument, IMongoIndexKeys

Type Parameters

TDocument

The type of the document.

Inheritance
IndexKeysBuilder<TDocument>
Implements
Inherited Members
Extension Methods

Constructors

IndexKeysBuilder()

Initializes a new instance of the IndexKeysBuilder class.

Methods

Ascending(params Expression<Func<TDocument, object>>[])

Sets one or more key names to index in ascending order.

Descending(params Expression<Func<TDocument, object>>[])

Sets one or more key names to index in descending order.

GeoSpatialHaystack<TMember>(Expression<Func<TDocument, TMember>>)

Sets the key name to create a geospatial haystack index on.

GeoSpatialHaystack<TMember, TAdditionalMember>(Expression<Func<TDocument, TMember>>, Expression<Func<TDocument, TAdditionalMember>>)

Sets the key name and additional field name to create a geospatial haystack index on.

GeoSpatialSpherical<TMember>(Expression<Func<TDocument, TMember>>)

Sets the key name to create a spherical geospatial index on.

GeoSpatial<TMember>(Expression<Func<TDocument, TMember>>)

Sets the key name to create a geospatial index on.

Hashed<TMember>(Expression<Func<TDocument, TMember>>)

Sets the key name to create a hashed index on.

Text(params Expression<Func<TDocument, IEnumerable<string>>>[])

Sets one or more key names to include in the text index.

Text(params Expression<Func<TDocument, string>>[])

Sets one or more key names to include in the text index.

TextAll()

Create a text index that indexes all text fields of a document.

ToBsonDocument()

Converts this object to a BsonDocument.

Wildcard(Expression<Func<TDocument, object>>)

Sets a wildcard key to the index.