Table of Contents

Method OfType

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

OfType<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, IBsonSerializer<TOutput>)

Appends a $match stage to the pipeline to select documents of a certain type.

public static PipelineDefinition<TInput, TOutput> OfType<TInput, TIntermediate, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, IBsonSerializer<TOutput> outputSerializer = null) where TOutput : TIntermediate

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

outputSerializer IBsonSerializer<TOutput>

The output serializer.

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