Table of Contents

Method SortBy

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

SortBy<TResult>(IAggregateFluent<TResult>, 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<TResult>

The aggregate.

field Expression<Func<TResult, object>>

The field to sort by.

Returns

IOrderedAggregateFluent<TResult>

The fluent aggregate interface.

Type Parameters

TResult

The type of the result.