Method Group

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

Namespace

MongoDB.Driver

Assembly

MongoDB.Driver.dll

Group(IAggregateFluent, 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

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, 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

The aggregate.

id Expression<Func<TResult, TKey>>

The id.

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

The group projection.

Returns

IAggregateFluent

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.