Table of Contents

Method Group

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Group<TResult>(IAggregateFluent<TResult>, ProjectionDefinition<TResult, BsonDocument>)

Appends a group stage to the pipeline.

public static IAggregateFluent<BsonDocument> Group<TResult>(this IAggregateFluent<TResult> aggregate, ProjectionDefinition<TResult, BsonDocument> group)

Parameters

aggregate IAggregateFluent<TResult>

The aggregate.

group ProjectionDefinition<TResult, BsonDocument>

The group projection.

Returns

IAggregateFluent<BsonDocument>

The fluent aggregate interface.

Type Parameters

TResult

The type of the result.

Group<TResult, TKey, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TKey>>, Expression<Func<IGrouping<TKey, TResult>, TNewResult>>)

Appends a group stage to the pipeline.

public static IAggregateFluent<TNewResult> Group<TResult, TKey, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TKey>> id, Expression<Func<IGrouping<TKey, TResult>, TNewResult>> group)

Parameters

aggregate IAggregateFluent<TResult>

The aggregate.

id Expression<Func<TResult, TKey>>

The id.

group Expression<Func<IGrouping<TKey, TResult>, TNewResult>>

The group projection.

Returns

IAggregateFluent<TNewResult>

The fluent aggregate interface.

Type Parameters

TResult

The type of the result.

TKey

The type of the key.

TNewResult

The type of the new result.