Table of Contents

Method Group

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Group<TInput, TOutput>(ProjectionDefinition<TInput, TOutput>)

Creates a $group stage.

public static PipelineStageDefinition<TInput, TOutput> Group<TInput, TOutput>(ProjectionDefinition<TInput, TOutput> group)

Parameters

group ProjectionDefinition<TInput, TOutput>

The group projection.

Returns

PipelineStageDefinition<TInput, TOutput>

The stage.

Type Parameters

TInput

The type of the input documents.

TOutput

The type of the output documents.

Group<TInput>(ProjectionDefinition<TInput, BsonDocument>)

Creates a $group stage.

public static PipelineStageDefinition<TInput, BsonDocument> Group<TInput>(ProjectionDefinition<TInput, BsonDocument> group)

Parameters

group ProjectionDefinition<TInput, BsonDocument>

The group projection.

Returns

PipelineStageDefinition<TInput, BsonDocument>

The stage.

Type Parameters

TInput

The type of the input documents.

Group<TInput, TValue, TOutput>(Expression<Func<TInput, TValue>>, Expression<Func<IGrouping<TValue, TInput>, TOutput>>, ExpressionTranslationOptions)

Creates a $group stage (this method can only be used with LINQ2).

public static PipelineStageDefinition<TInput, TOutput> Group<TInput, TValue, TOutput>(Expression<Func<TInput, TValue>> value, Expression<Func<IGrouping<TValue, TInput>, TOutput>> group, ExpressionTranslationOptions translationOptions = null)

Parameters

value Expression<Func<TInput, TValue>>

The value field.

group Expression<Func<IGrouping<TValue, TInput>, TOutput>>

The group projection.

translationOptions ExpressionTranslationOptions

The translation options.

Returns

PipelineStageDefinition<TInput, TOutput>

The stage.

Type Parameters

TInput

The type of the input documents.

TValue

The type of the values.

TOutput

The type of the output documents.

Remarks

This method can only be used with LINQ2 but that can't be verified until Render is called.