Table of Contents

Method ReplaceWith

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

ReplaceWith<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, AggregateExpressionDefinition<TIntermediate, TOutput>)

Appends a $replaceWith stage to the pipeline.

public static PipelineDefinition<TInput, TOutput> ReplaceWith<TInput, TIntermediate, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, AggregateExpressionDefinition<TIntermediate, TOutput> newRoot)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

newRoot AggregateExpressionDefinition<TIntermediate, TOutput>

The new root.

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.

TOutput

The type of the output documents.

ReplaceWith<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TOutput>>, ExpressionTranslationOptions)

Appends a $replaceWith stage to the pipeline.

public static PipelineDefinition<TInput, TOutput> ReplaceWith<TInput, TIntermediate, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, Expression<Func<TIntermediate, TOutput>> newRoot, ExpressionTranslationOptions translationOptions = null)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

newRoot Expression<Func<TIntermediate, TOutput>>

The new root.

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.

TOutput

The type of the output documents.