Method SortBy

| MongoDB CSharp Driver API Reference (original) (raw)

Namespace

MongoDB.Driver

Assembly

MongoDB.Driver.dll

SortBy(IAggregateFluent, Expression<Func<TResult, object>>)

Appends an ascending sort stage to the pipeline.

public static IOrderedAggregateFluent<TResult> SortBy<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field)

Parameters

aggregate IAggregateFluent

The aggregate.

field Expression<Func<TResult, object>>

The field to sort by.

Returns

IOrderedAggregateFluent

The fluent aggregate interface.

Type Parameters

TResult

The type of the result.