Method Bucket

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

Namespace

MongoDB.Driver

Assembly

MongoDB.Driver.dll

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

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

The aggregate.

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

TResult

The type of the result.

TValue

The type of the value.

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

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

The aggregate.

groupBy Expression<Func<TResult, TValue>>

The expression providing the value to group by.

boundaries IEnumerable

The bucket boundaries.

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

The output projection.

options AggregateBucketOptions

The options.

Returns

IAggregateFluent

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.