Method Project

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

Namespace

MongoDB.Driver

Assembly

MongoDB.Driver.dll

Project<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, ProjectionDefinition<TIntermediate, TOutput>)

Appends a $project stage to the pipeline.

public static PipelineDefinition<TInput, TOutput> Project<TInput, TIntermediate, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, ProjectionDefinition<TIntermediate, TOutput> projection)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

projection ProjectionDefinition<TIntermediate, TOutput>

The projection.

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.

Exceptions

NotSupportedException

Project<TInput, TIntermediate>(PipelineDefinition<TInput, TIntermediate>, ProjectionDefinition<TIntermediate, BsonDocument>)

Appends a project stage to the pipeline.

public static PipelineDefinition<TInput, BsonDocument> Project<TInput, TIntermediate>(this PipelineDefinition<TInput, TIntermediate> pipeline, ProjectionDefinition<TIntermediate, BsonDocument> projection)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

projection ProjectionDefinition<TIntermediate, BsonDocument>

The projection.

Returns

PipelineDefinition<TInput, BsonDocument>

A new pipeline with an additional stage.

Type Parameters

TInput

The type of the input documents.

TIntermediate

The type of the intermediate documents.

Project<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TOutput>>)

Appends a project stage to the pipeline.

public static PipelineDefinition<TInput, TOutput> Project<TInput, TIntermediate, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, Expression<Func<TIntermediate, TOutput>> projection)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

projection Expression<Func<TIntermediate, TOutput>>

The projection.

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.