Table of Contents

Class SortDefinitionExtensions

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Extension methods for SortDefinition.

public static class SortDefinitionExtensions
Inheritance
SortDefinitionExtensions
Inherited Members

Methods

Ascending<TDocument>(SortDefinition<TDocument>, FieldDefinition<TDocument>)

Combines an existing sort with an ascending field.

public static SortDefinition<TDocument> Ascending<TDocument>(this SortDefinition<TDocument> sort, FieldDefinition<TDocument> field)

Parameters

sort SortDefinition<TDocument>

The sort.

field FieldDefinition<TDocument>

The field.

Returns

SortDefinition<TDocument>

A combined sort.

Type Parameters

TDocument

The type of the document.

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

Combines an existing sort with an ascending field.

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

Parameters

sort SortDefinition<TDocument>

The sort.

field Expression<Func<TDocument, object>>

The field.

Returns

SortDefinition<TDocument>

A combined sort.

Type Parameters

TDocument

The type of the document.

Descending<TDocument>(SortDefinition<TDocument>, FieldDefinition<TDocument>)

Combines an existing sort with an descending field.

public static SortDefinition<TDocument> Descending<TDocument>(this SortDefinition<TDocument> sort, FieldDefinition<TDocument> field)

Parameters

sort SortDefinition<TDocument>

The sort.

field FieldDefinition<TDocument>

The field.

Returns

SortDefinition<TDocument>

A combined sort.

Type Parameters

TDocument

The type of the document.

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

Combines an existing sort with an descending field.

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

Parameters

sort SortDefinition<TDocument>

The sort.

field Expression<Func<TDocument, object>>

The field.

Returns

SortDefinition<TDocument>

A combined sort.

Type Parameters

TDocument

The type of the document.

MetaTextScore<TDocument>(SortDefinition<TDocument>, string)

Combines an existing sort with a descending sort on the computed relevance score of a text search. The field name should be the name of the projected relevance score field.

public static SortDefinition<TDocument> MetaTextScore<TDocument>(this SortDefinition<TDocument> sort, string field)

Parameters

sort SortDefinition<TDocument>

The sort.

field string

The field.

Returns

SortDefinition<TDocument>

A combined sort.

Type Parameters

TDocument

The type of the document.