Table of Contents

Method BucketAutoForLinq2

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

BucketAutoForLinq2<TInput, TIntermediate, TValue, TOutput>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TValue>>, int, Expression<Func<IGrouping<TValue, TIntermediate>, TOutput>>, AggregateBucketAutoOptions, ExpressionTranslationOptions)

Appends a $bucketAuto stage to the pipeline (this method can only be used with LINQ2).

public static PipelineDefinition<TInput, TOutput> BucketAutoForLinq2<TInput, TIntermediate, TValue, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, Expression<Func<TIntermediate, TValue>> groupBy, int buckets, Expression<Func<IGrouping<TValue, TIntermediate>, TOutput>> output, AggregateBucketAutoOptions options = null, ExpressionTranslationOptions translationOptions = null)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

groupBy Expression<Func<TIntermediate, TValue>>

The group by expression.

buckets int

The number of buckets.

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

The output projection.

options AggregateBucketAutoOptions

The options (optional).

translationOptions ExpressionTranslationOptions

The translation 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 value.

TOutput

The type of the output documents.