Method Bucket

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

Namespace

MongoDB.Driver

Assembly

MongoDB.Driver.dll

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

Appends a $bucket stage to the pipeline.

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

The bucket boundaries.

options AggregateBucketOptions

The options.

Returns

IAggregateFluent<AggregateBucketResult>

The fluent aggregate interface.

Type Parameters

TValue

The type of the value.

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

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

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

The bucket boundaries.

output ProjectionDefinition<TResult, TNewResult>

The output projection.

options AggregateBucketOptions

The options.

Returns

IAggregateFluent

The fluent aggregate interface.

Type Parameters

TValue

The type of the value.

TNewResult

The type of the new result.