Table of Contents

Method Bucket

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

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

Appends a $bucket stage to the pipeline.

public virtual IAggregateFluent<AggregateBucketResult<TValue>> Bucket<TValue>(AggregateExpressionDefinition<TResult, TValue> groupBy, IEnumerable<TValue> boundaries, AggregateBucketOptions<TValue> options = null)

Parameters

groupBy AggregateExpressionDefinition<TResult, TValue>

The expression providing the value to group by.

boundaries IEnumerable<TValue>

The bucket boundaries.

options AggregateBucketOptions<TValue>

The options.

Returns

IAggregateFluent<AggregateBucketResult<TValue>>

The fluent aggregate interface.

Type Parameters

TValue

The type of the value.

Bucket<TValue, TNewResult>(AggregateExpressionDefinition<TResult, TValue>, IEnumerable<TValue>, ProjectionDefinition<TResult, TNewResult>, AggregateBucketOptions<TValue>)

Appends a $bucket stage to the pipeline with a custom projection.

public virtual IAggregateFluent<TNewResult> Bucket<TValue, TNewResult>(AggregateExpressionDefinition<TResult, TValue> groupBy, IEnumerable<TValue> boundaries, ProjectionDefinition<TResult, TNewResult> output, AggregateBucketOptions<TValue> options = null)

Parameters

groupBy AggregateExpressionDefinition<TResult, TValue>

The expression providing the value to group by.

boundaries IEnumerable<TValue>

The bucket boundaries.

output ProjectionDefinition<TResult, TNewResult>

The output projection.

options AggregateBucketOptions<TValue>

The options.

Returns

IAggregateFluent<TNewResult>

The fluent aggregate interface.

Type Parameters

TValue

The type of the value.

TNewResult

The type of the new result.