Table of Contents

Class IndexKeysDefinitionBuilder<TDocument>

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll
public sealed class IndexKeysDefinitionBuilder<TDocument>

Type Parameters

TDocument

The type of the document.

Inheritance
IndexKeysDefinitionBuilder<TDocument>
Inherited Members

Methods

Ascending(FieldDefinition<TDocument>)

Creates an ascending index key definition.

public IndexKeysDefinition<TDocument> Ascending(FieldDefinition<TDocument> field)

Parameters

field FieldDefinition<TDocument>

The field.

Returns

IndexKeysDefinition<TDocument>

An ascending index key definition.

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

Creates an ascending index key definition.

public IndexKeysDefinition<TDocument> Ascending(Expression<Func<TDocument, object>> field)

Parameters

field Expression<Func<TDocument, object>>

The field.

Returns

IndexKeysDefinition<TDocument>

An ascending index key definition.

Combine(params IndexKeysDefinition<TDocument>[])

Creates a combined index keys definition.

public IndexKeysDefinition<TDocument> Combine(params IndexKeysDefinition<TDocument>[] keys)

Parameters

keys IndexKeysDefinition<TDocument>[]

The keys.

Returns

IndexKeysDefinition<TDocument>

A combined index keys definition.

Combine(IEnumerable<IndexKeysDefinition<TDocument>>)

Creates a combined index keys definition.

public IndexKeysDefinition<TDocument> Combine(IEnumerable<IndexKeysDefinition<TDocument>> keys)

Parameters

keys IEnumerable<IndexKeysDefinition<TDocument>>

The keys.

Returns

IndexKeysDefinition<TDocument>

A combined index keys definition.

Descending(FieldDefinition<TDocument>)

Creates a descending index key definition.

public IndexKeysDefinition<TDocument> Descending(FieldDefinition<TDocument> field)

Parameters

field FieldDefinition<TDocument>

The field.

Returns

IndexKeysDefinition<TDocument>

A descending index key definition.

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

Creates a descending index key definition.

public IndexKeysDefinition<TDocument> Descending(Expression<Func<TDocument, object>> field)

Parameters

field Expression<Func<TDocument, object>>

The field.

Returns

IndexKeysDefinition<TDocument>

A descending index key definition.

Geo2D(FieldDefinition<TDocument>)

Creates a 2d index key definition.

public IndexKeysDefinition<TDocument> Geo2D(FieldDefinition<TDocument> field)

Parameters

field FieldDefinition<TDocument>

The field.

Returns

IndexKeysDefinition<TDocument>

A 2d index key definition.

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

Creates a 2d index key definition.

public IndexKeysDefinition<TDocument> Geo2D(Expression<Func<TDocument, object>> field)

Parameters

field Expression<Func<TDocument, object>>

The field.

Returns

IndexKeysDefinition<TDocument>

A 2d index key definition.

Geo2DSphere(FieldDefinition<TDocument>)

Creates a 2dsphere index key definition.

public IndexKeysDefinition<TDocument> Geo2DSphere(FieldDefinition<TDocument> field)

Parameters

field FieldDefinition<TDocument>

The field.

Returns

IndexKeysDefinition<TDocument>

A 2dsphere index key definition.

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

Creates a 2dsphere index key definition.

public IndexKeysDefinition<TDocument> Geo2DSphere(Expression<Func<TDocument, object>> field)

Parameters

field Expression<Func<TDocument, object>>

The field.

Returns

IndexKeysDefinition<TDocument>

A 2dsphere index key definition.

GeoHaystack(FieldDefinition<TDocument>, FieldDefinition<TDocument>)

Creates a geo haystack index key definition.

[Obsolete("GeoHaystack indexes were deprecated in server version 4.4.")]
public IndexKeysDefinition<TDocument> GeoHaystack(FieldDefinition<TDocument> field, FieldDefinition<TDocument> additionalFieldName = null)

Parameters

field FieldDefinition<TDocument>

The field.

additionalFieldName FieldDefinition<TDocument>

Name of the additional field.

Returns

IndexKeysDefinition<TDocument>

A geo haystack index key definition.

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

Creates a geo haystack index key definition.

[Obsolete("GeoHaystack indexes were deprecated in server version 4.4.")]
public IndexKeysDefinition<TDocument> GeoHaystack(Expression<Func<TDocument, object>> field, Expression<Func<TDocument, object>> additionalFieldName = null)

Parameters

field Expression<Func<TDocument, object>>

The field.

additionalFieldName Expression<Func<TDocument, object>>

Name of the additional field.

Returns

IndexKeysDefinition<TDocument>

A geo haystack index key definition.

Hashed(FieldDefinition<TDocument>)

Creates a hashed index key definition.

public IndexKeysDefinition<TDocument> Hashed(FieldDefinition<TDocument> field)

Parameters

field FieldDefinition<TDocument>

The field.

Returns

IndexKeysDefinition<TDocument>

A hashed index key definition.

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

Creates a hashed index key definition.

public IndexKeysDefinition<TDocument> Hashed(Expression<Func<TDocument, object>> field)

Parameters

field Expression<Func<TDocument, object>>

The field.

Returns

IndexKeysDefinition<TDocument>

A hashed index key definition.

Text(FieldDefinition<TDocument>)

Creates a text index key definition.

public IndexKeysDefinition<TDocument> Text(FieldDefinition<TDocument> field)

Parameters

field FieldDefinition<TDocument>

The field.

Returns

IndexKeysDefinition<TDocument>

A text index key definition.

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

Creates a text index key definition.

public IndexKeysDefinition<TDocument> Text(Expression<Func<TDocument, object>> field)

Parameters

field Expression<Func<TDocument, object>>

The field.

Returns

IndexKeysDefinition<TDocument>

A text index key definition.

Wildcard(FieldDefinition<TDocument>)

Creates a wildcard index key definition. The method doesn't expect to specify a wildcard key explicitly.

public IndexKeysDefinition<TDocument> Wildcard(FieldDefinition<TDocument> field = null)

Parameters

field FieldDefinition<TDocument>

The wildcard key name. If the wildcard name is empty, the generated key will be All field paths, otherwise A single field path.

Returns

IndexKeysDefinition<TDocument>

A wildcard index key definition.

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

Creates a wildcard index key definition.

public IndexKeysDefinition<TDocument> Wildcard(Expression<Func<TDocument, object>> field)

Parameters

field Expression<Func<TDocument, object>>

The field expression representing the wildcard key name.

Returns

IndexKeysDefinition<TDocument>

A wildcard index key definition.