/// <summary> /// Appends a $bucketAuto stage to the pipeline. /// </summary> /// <typeparam name="TResult">The type of the result.</typeparam> /// <typeparam name="TValue">The type of the value.</typeparam> /// <param name="aggregate">The aggregate.</param> /// <param name="groupBy">The expression providing the value to group by.</param> /// <param name="buckets">The number of buckets.</param> /// <param name="options">The options (optional).</param> /// <returns>The fluent aggregate interface.</returns> public static IAggregateFluent <AggregateBucketAutoResult <TValue> > BucketAuto <TResult, TValue>( this IAggregateFluent <TResult> aggregate, Expression <Func <TResult, TValue> > groupBy, int buckets, AggregateBucketAutoOptions options = null) { Ensure.IsNotNull(aggregate, nameof(aggregate)); return(aggregate.AppendStage(PipelineStageDefinitionBuilder.BucketAuto(groupBy, buckets, options))); }