Table of Contents

Method SortByCount

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

SortByCount<TInput, TIntermediate, TValue>(PipelineDefinition<TInput, TIntermediate>, AggregateExpressionDefinition<TIntermediate, TValue>)

Appends a $sortByCount stage to the pipeline.

public static PipelineDefinition<TInput, AggregateSortByCountResult<TValue>> SortByCount<TInput, TIntermediate, TValue>(this PipelineDefinition<TInput, TIntermediate> pipeline, AggregateExpressionDefinition<TIntermediate, TValue> value)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

value AggregateExpressionDefinition<TIntermediate, TValue>

The value expression.

Returns

PipelineDefinition<TInput, AggregateSortByCountResult<TValue>>

A new pipeline with an additional stage.

Type Parameters

TInput

The type of the input documents.

TIntermediate

The type of the intermediate documents.

TValue

The type of the values.

SortByCount<TInput, TIntermediate, TValue>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TValue>>)

Appends a sortByCount stage to the pipeline.

public static PipelineDefinition<TInput, AggregateSortByCountResult<TValue>> SortByCount<TInput, TIntermediate, TValue>(this PipelineDefinition<TInput, TIntermediate> pipeline, Expression<Func<TIntermediate, TValue>> value)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

value Expression<Func<TIntermediate, TValue>>

The value expression.

Returns

PipelineDefinition<TInput, AggregateSortByCountResult<TValue>>

A new pipeline with an additional stage.

Type Parameters

TInput

The type of the input documents.

TIntermediate

The type of the intermediate documents.

TValue

The type of the values.