Table of Contents

Method Bucket

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Bucket<TResult, TValue>(IAggregateFluent<TResult>, Expression<Func<TResult, TValue>>, IEnumerable<TValue>, AggregateBucketOptions<TValue>)

Appends a $bucket stage to the pipeline.

public static IAggregateFluent<AggregateBucketResult<TValue>> Bucket<TResult, TValue>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TValue>> groupBy, IEnumerable<TValue> boundaries, AggregateBucketOptions<TValue> options = null)

Parameters

aggregate IAggregateFluent<TResult>

The aggregate.

groupBy Expression<Func<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

TResult

The type of the result.

TValue

The type of the value.

Bucket<TResult, TValue, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TValue>>, IEnumerable<TValue>, Expression<Func<IGrouping<TValue, TResult>, TNewResult>>, AggregateBucketOptions<TValue>)

Appends a $bucket stage to the pipeline.

public static IAggregateFluent<TNewResult> Bucket<TResult, TValue, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TValue>> groupBy, IEnumerable<TValue> boundaries, Expression<Func<IGrouping<TValue, TResult>, TNewResult>> output, AggregateBucketOptions<TValue> options = null)

Parameters

aggregate IAggregateFluent<TResult>

The aggregate.

groupBy Expression<Func<TResult, TValue>>

The expression providing the value to group by.

boundaries IEnumerable<TValue>

The bucket boundaries.

output Expression<Func<IGrouping<TValue, TResult>, TNewResult>>

The output projection.

options AggregateBucketOptions<TValue>

The options.

Returns

IAggregateFluent<TNewResult>

The fluent aggregate interface.

Type Parameters

TResult

The type of the result.

TValue

The type of the value.

TNewResult

The type of the new result.