Table of Contents

Class SortDefinitionBuilder<TDocument>

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

A builder for a SortDefinition<TDocument>.

public sealed class SortDefinitionBuilder<TDocument>

Type Parameters

TDocument

The type of the document.

Inheritance
SortDefinitionBuilder<TDocument>
Inherited Members

Methods

Ascending(FieldDefinition<TDocument>)

Creates an ascending sort.

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

Parameters

field FieldDefinition<TDocument>

The field.

Returns

SortDefinition<TDocument>

An ascending sort.

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

Creates an ascending sort.

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

Parameters

field Expression<Func<TDocument, object>>

The field.

Returns

SortDefinition<TDocument>

An ascending sort.

Combine(params SortDefinition<TDocument>[])

Creates a combined sort.

public SortDefinition<TDocument> Combine(params SortDefinition<TDocument>[] sorts)

Parameters

sorts SortDefinition<TDocument>[]

The sorts.

Returns

SortDefinition<TDocument>

A combined sort.

Combine(IEnumerable<SortDefinition<TDocument>>)

Creates a combined sort.

public SortDefinition<TDocument> Combine(IEnumerable<SortDefinition<TDocument>> sorts)

Parameters

sorts IEnumerable<SortDefinition<TDocument>>

The sorts.

Returns

SortDefinition<TDocument>

A combined sort.

Descending(FieldDefinition<TDocument>)

Creates a descending sort.

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

Parameters

field FieldDefinition<TDocument>

The field.

Returns

SortDefinition<TDocument>

A descending sort.

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

Creates a descending sort.

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

Parameters

field Expression<Func<TDocument, object>>

The field.

Returns

SortDefinition<TDocument>

A descending sort.

MetaTextScore(string)

Creates a descending sort on the computed relevance score of a text search. The name of the key should be the name of the projected relevence score field.

public SortDefinition<TDocument> MetaTextScore(string field)

Parameters

field string

The field.

Returns

SortDefinition<TDocument>

A meta text score sort.