Table of Contents

Method Bucket

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Bucket<TInput, TValue>(AggregateExpressionDefinition<TInput, TValue>, IEnumerable<TValue>, AggregateBucketOptions<TValue>)

Creates a $bucket stage.

public static PipelineStageDefinition<TInput, AggregateBucketResult<TValue>> Bucket<TInput, TValue>(AggregateExpressionDefinition<TInput, TValue> groupBy, IEnumerable<TValue> boundaries, AggregateBucketOptions<TValue> options = null)

Parameters

groupBy AggregateExpressionDefinition<TInput, TValue>

The group by expression.

boundaries IEnumerable<TValue>

The boundaries.

options AggregateBucketOptions<TValue>

The options.

Returns

PipelineStageDefinition<TInput, AggregateBucketResult<TValue>>

The stage.

Type Parameters

TInput

The type of the input documents.

TValue

The type of the values.

Bucket<TInput, TValue, TOutput>(AggregateExpressionDefinition<TInput, TValue>, IEnumerable<TValue>, ProjectionDefinition<TInput, TOutput>, AggregateBucketOptions<TValue>)

Creates a $bucket stage.

public static PipelineStageDefinition<TInput, TOutput> Bucket<TInput, TValue, TOutput>(AggregateExpressionDefinition<TInput, TValue> groupBy, IEnumerable<TValue> boundaries, ProjectionDefinition<TInput, TOutput> output, AggregateBucketOptions<TValue> options = null)

Parameters

groupBy AggregateExpressionDefinition<TInput, TValue>

The group by expression.

boundaries IEnumerable<TValue>

The boundaries.

output ProjectionDefinition<TInput, TOutput>

The output projection.

options AggregateBucketOptions<TValue>

The 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.

Bucket<TInput, TValue>(Expression<Func<TInput, TValue>>, IEnumerable<TValue>, AggregateBucketOptions<TValue>, ExpressionTranslationOptions)

Creates a $bucket stage.

public static PipelineStageDefinition<TInput, AggregateBucketResult<TValue>> Bucket<TInput, TValue>(Expression<Func<TInput, TValue>> groupBy, IEnumerable<TValue> boundaries, AggregateBucketOptions<TValue> options = null, ExpressionTranslationOptions translationOptions = null)

Parameters

groupBy Expression<Func<TInput, TValue>>

The group by expression.

boundaries IEnumerable<TValue>

The boundaries.

options AggregateBucketOptions<TValue>

The options.

translationOptions ExpressionTranslationOptions

The translation options.

Returns

PipelineStageDefinition<TInput, AggregateBucketResult<TValue>>

The stage.

Type Parameters

TInput

The type of the input documents.

TValue

The type of the values.

Bucket<TInput, TValue, TOutput>(Expression<Func<TInput, TValue>>, IEnumerable<TValue>, Expression<Func<IGrouping<TValue, TInput>, TOutput>>, AggregateBucketOptions<TValue>, ExpressionTranslationOptions)

Creates a $bucket stage.

public static PipelineStageDefinition<TInput, TOutput> Bucket<TInput, TValue, TOutput>(Expression<Func<TInput, TValue>> groupBy, IEnumerable<TValue> boundaries, Expression<Func<IGrouping<TValue, TInput>, TOutput>> output, AggregateBucketOptions<TValue> options = null, ExpressionTranslationOptions translationOptions = null)

Parameters

groupBy Expression<Func<TInput, TValue>>

The group by expression.

boundaries IEnumerable<TValue>

The boundaries.

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

The output projection.

options AggregateBucketOptions<TValue>

The options.

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.