/// <summary> /// Appends a $setWindowFields to the pipeline. /// </summary> /// <typeparam name="TResult">The type of the result.</typeparam> /// <typeparam name="TWindowFields">The type of the added window fields.</typeparam> /// <param name="aggregate">The aggregate.</param> /// <param name="output">The window fields expression.</param> /// <returns>The fluent aggregate interface.</returns> public static IAggregateFluent <BsonDocument> SetWindowFields <TResult, TWindowFields>( this IAggregateFluent <TResult> aggregate, Expression <Func <ISetWindowFieldsPartition <TResult>, TWindowFields> > output) { Ensure.IsNotNull(aggregate, nameof(aggregate)); return(aggregate.AppendStage(PipelineStageDefinitionBuilder.SetWindowFields(output))); }