Table of Contents

Method Bucket

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

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

Appends a $bucket stage to the pipeline.

public static PipelineDefinition<TInput, AggregateBucketResult<TValue>> Bucket<TInput, TIntermediate, TValue>(this PipelineDefinition<TInput, TIntermediate> pipeline, AggregateExpressionDefinition<TIntermediate, TValue> groupBy, IEnumerable<TValue> boundaries, AggregateBucketOptions<TValue> options = null)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

groupBy AggregateExpressionDefinition<TIntermediate, TValue>

The group by expression.

boundaries IEnumerable<TValue>

The boundaries.

options AggregateBucketOptions<TValue>

The options.

Returns

PipelineDefinition<TInput, AggregateBucketResult<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.

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

Appends a $bucket stage to the pipeline.

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

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

groupBy AggregateExpressionDefinition<TIntermediate, TValue>

The group by expression.

boundaries IEnumerable<TValue>

The boundaries.

output ProjectionDefinition<TIntermediate, TOutput>

The output projection.

options AggregateBucketOptions<TValue>

The options.

Returns

PipelineDefinition<TInput, TOutput>

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.

TOutput

The type of the output documents.

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

Appends a $bucket stage to the pipeline.

public static PipelineDefinition<TInput, AggregateBucketResult<TValue>> Bucket<TInput, TIntermediate, TValue>(this PipelineDefinition<TInput, TIntermediate> pipeline, Expression<Func<TIntermediate, TValue>> groupBy, IEnumerable<TValue> boundaries, AggregateBucketOptions<TValue> options = null)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

groupBy Expression<Func<TIntermediate, TValue>>

The group by expression.

boundaries IEnumerable<TValue>

The boundaries.

options AggregateBucketOptions<TValue>

The options.

Returns

PipelineDefinition<TInput, AggregateBucketResult<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.

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

Appends a $bucket stage to the pipeline.

public static PipelineDefinition<TInput, TOutput> Bucket<TInput, TIntermediate, TValue, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, Expression<Func<TIntermediate, TValue>> groupBy, IEnumerable<TValue> boundaries, Expression<Func<IGrouping<TValue, TIntermediate>, TOutput>> output, AggregateBucketOptions<TValue> options = null)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

groupBy Expression<Func<TIntermediate, TValue>>

The group by expression.

boundaries IEnumerable<TValue>

The boundaries.

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

The output projection.

options AggregateBucketOptions<TValue>

The options.

Returns

PipelineDefinition<TInput, TOutput>

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.

TOutput

The type of the output documents.