Table of Contents

Class PipelineDefinitionBuilder

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Extension methods for adding stages to a pipeline.

public static class PipelineDefinitionBuilder
Inheritance
PipelineDefinitionBuilder
Inherited Members

Methods

AppendStage<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, PipelineStageDefinition<TIntermediate, TOutput>, IBsonSerializer<TOutput>)

Appends a stage to the pipeline.

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

Changes the output type of the pipeline.

BucketAuto<TInput, TIntermediate, TValue>(PipelineDefinition<TInput, TIntermediate>, AggregateExpressionDefinition<TIntermediate, TValue>, int, AggregateBucketAutoOptions)

Appends a $bucketAuto stage to the pipeline.

BucketAuto<TInput, TIntermediate, TValue>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TValue>>, int, AggregateBucketAutoOptions)

Appends a $bucketAuto stage to the pipeline.

BucketAuto<TInput, TIntermediate, TValue, TOutput>(PipelineDefinition<TInput, TIntermediate>, AggregateExpressionDefinition<TIntermediate, TValue>, int, ProjectionDefinition<TIntermediate, TOutput>, AggregateBucketAutoOptions)

Appends a $bucketAuto stage to the pipeline.

BucketAuto<TInput, TIntermediate, TValue, TOutput>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TValue>>, int, Expression<Func<IGrouping<AggregateBucketAutoResultId<TValue>, TIntermediate>, TOutput>>, AggregateBucketAutoOptions)

Appends a $bucketAuto stage to the pipeline (this overload can only be used with LINQ3).

Bucket<TInput, TIntermediate, TValue>(PipelineDefinition<TInput, TIntermediate>, AggregateExpressionDefinition<TIntermediate, TValue>, IEnumerable<TValue>, AggregateBucketOptions<TValue>)

Appends a $bucket stage to the pipeline.

Bucket<TInput, TIntermediate, TValue>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TValue>>, IEnumerable<TValue>, AggregateBucketOptions<TValue>)

Appends a $bucket stage to the pipeline.

Bucket<TInput, TIntermediate, TValue, TOutput>(PipelineDefinition<TInput, TIntermediate>, AggregateExpressionDefinition<TIntermediate, TValue>, IEnumerable<TValue>, ProjectionDefinition<TIntermediate, TOutput>, AggregateBucketOptions<TValue>)

Appends a $bucket stage to the pipeline.

Bucket<TInput, TIntermediate, TValue, TOutput>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TValue>>, IEnumerable<TValue>, Expression<Func<IGrouping<TValue, TIntermediate>, TOutput>>, AggregateBucketOptions<TValue>)

Appends a $bucket stage to the pipeline.

ChangeStreamSplitLargeEvent<TInput>(PipelineDefinition<ChangeStreamDocument<TInput>, ChangeStreamDocument<TInput>>)

Appends a $changeStreamSplitLargeEvent stage.

ChangeStream<TInput, TIntermediate>(PipelineDefinition<TInput, TIntermediate>, ChangeStreamStageOptions)

Appends a $changeStream stage to the pipeline. Normally you would prefer to use the Watch method of IMongoCollection<TDocument>. Only use this method if subsequent stages project away the resume token (the _id) or you don't want the resulting cursor to automatically resume.

Count<TInput, TIntermediate>(PipelineDefinition<TInput, TIntermediate>)

Appends a $count stage to the pipeline.

Densify<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, FieldDefinition<TOutput>, DensifyRange, params FieldDefinition<TOutput>[])

Appends a $densify stage to the pipeline.

Densify<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, FieldDefinition<TOutput>, DensifyRange, IEnumerable<FieldDefinition<TOutput>>)

Appends a $densify stage to the pipeline.

Densify<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, Expression<Func<TOutput, object>>, DensifyRange, IEnumerable<Expression<Func<TOutput, object>>>)

Appends a $densify stage to the pipeline.

Densify<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, Expression<Func<TOutput, object>>, DensifyRange, params Expression<Func<TOutput, object>>[])

Appends a $densify stage to the pipeline.

Documents<TDocument>(PipelineDefinition<NoPipelineInput, NoPipelineInput>, AggregateExpressionDefinition<NoPipelineInput, IEnumerable<TDocument>>, IBsonSerializer<TDocument>)

Appends a $documents stage to the pipeline.

Documents<TDocument>(PipelineDefinition<NoPipelineInput, NoPipelineInput>, IEnumerable<TDocument>, IBsonSerializer<TDocument>)

Appends a $documents stage to the pipeline.

Facet<TInput, TIntermediate>(PipelineDefinition<TInput, TIntermediate>, params AggregateFacet<TIntermediate>[])

Appends a $facet stage to the pipeline.

Facet<TInput, TIntermediate>(PipelineDefinition<TInput, TIntermediate>, IEnumerable<AggregateFacet<TIntermediate>>)

Appends a $facet stage to the pipeline.

Facet<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, params AggregateFacet<TIntermediate>[])

Appends a $facet stage to the pipeline.

Facet<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, IEnumerable<AggregateFacet<TIntermediate>>, AggregateFacetOptions<TOutput>)

Appends a $facet stage to the pipeline.

For<TInput>(IBsonSerializer<TInput>)

Used to start creating a pipeline for {TInput} documents.

GraphLookup<TInput, TIntermediate, TFrom>(PipelineDefinition<TInput, TIntermediate>, IMongoCollection<TFrom>, FieldDefinition<TFrom, BsonValue>, FieldDefinition<TFrom, BsonValue>, AggregateExpressionDefinition<TIntermediate, BsonValue>, FieldDefinition<BsonDocument, IEnumerable<BsonDocument>>, FieldDefinition<BsonDocument, int>)

Appends a $graphLookup stage to the pipeline.

GraphLookup<TInput, TIntermediate, TFrom, TConnectFrom, TConnectTo, TStartWith, TAs, TOutput>(PipelineDefinition<TInput, TIntermediate>, IMongoCollection<TFrom>, FieldDefinition<TFrom, TConnectFrom>, FieldDefinition<TFrom, TConnectTo>, AggregateExpressionDefinition<TIntermediate, TStartWith>, FieldDefinition<TOutput, TAs>, AggregateGraphLookupOptions<TFrom, TFrom, TOutput>)

Appends a $graphLookup stage to the pipeline.

GraphLookup<TInput, TIntermediate, TFrom, TConnectFrom, TConnectTo, TStartWith, TAs, TOutput>(PipelineDefinition<TInput, TIntermediate>, IMongoCollection<TFrom>, Expression<Func<TFrom, TConnectFrom>>, Expression<Func<TFrom, TConnectTo>>, Expression<Func<TIntermediate, TStartWith>>, Expression<Func<TOutput, TAs>>, AggregateGraphLookupOptions<TFrom, TFrom, TOutput>)

Appends a $graphLookup stage to the pipeline.

GraphLookup<TInput, TIntermediate, TFrom, TConnectFrom, TConnectTo, TStartWith, TAsElement, TAs, TOutput>(PipelineDefinition<TInput, TIntermediate>, IMongoCollection<TFrom>, FieldDefinition<TFrom, TConnectFrom>, FieldDefinition<TFrom, TConnectTo>, AggregateExpressionDefinition<TIntermediate, TStartWith>, FieldDefinition<TOutput, TAs>, FieldDefinition<TAsElement, int>, AggregateGraphLookupOptions<TFrom, TAsElement, TOutput>)

Appends a $graphLookup stage to the pipeline.

GraphLookup<TInput, TIntermediate, TFrom, TConnectFrom, TConnectTo, TStartWith, TAsElement, TAs, TOutput>(PipelineDefinition<TInput, TIntermediate>, IMongoCollection<TFrom>, Expression<Func<TFrom, TConnectFrom>>, Expression<Func<TFrom, TConnectTo>>, Expression<Func<TIntermediate, TStartWith>>, Expression<Func<TOutput, TAs>>, Expression<Func<TAsElement, int>>, AggregateGraphLookupOptions<TFrom, TAsElement, TOutput>)

Appends a $graphLookup stage to the pipeline.

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

Appends a group stage to the pipeline.

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

Appends a $group stage to the pipeline.

Group<TInput, TIntermediate, TKey, TOutput>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TKey>>, Expression<Func<IGrouping<TKey, TIntermediate>, TOutput>>)

Appends a group stage to the pipeline.

Limit<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, long)

Appends a $limit stage to the pipeline.

Lookup<TInput, TIntermediate, TForeignDocument, TOutput>(PipelineDefinition<TInput, TIntermediate>, IMongoCollection<TForeignDocument>, FieldDefinition<TIntermediate>, FieldDefinition<TForeignDocument>, FieldDefinition<TOutput>, AggregateLookupOptions<TForeignDocument, TOutput>)

Appends a $lookup stage to the pipeline.

Lookup<TInput, TIntermediate, TForeignDocument, TOutput>(PipelineDefinition<TInput, TIntermediate>, IMongoCollection<TForeignDocument>, Expression<Func<TIntermediate, object>>, Expression<Func<TForeignDocument, object>>, Expression<Func<TOutput, object>>, AggregateLookupOptions<TForeignDocument, TOutput>)

Appends a lookup stage to the pipeline.

Lookup<TInput, TIntermediate, TForeignDocument, TAsElement, TAs, TOutput>(PipelineDefinition<TInput, TIntermediate>, IMongoCollection<TForeignDocument>, BsonDocument, PipelineDefinition<TForeignDocument, TAsElement>, FieldDefinition<TOutput, TAs>, AggregateLookupOptions<TForeignDocument, TOutput>)

Appends a $lookup stage to the pipeline.

Lookup<TInput, TIntermediate, TForeignDocument, TAsElement, TAs, TOutput>(PipelineDefinition<TInput, TIntermediate>, IMongoCollection<TForeignDocument>, BsonDocument, PipelineDefinition<TForeignDocument, TAsElement>, Expression<Func<TOutput, TAs>>, AggregateLookupOptions<TForeignDocument, TOutput>)

Appends a $lookup stage to the pipeline.

Match<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, FilterDefinition<TOutput>)

Appends a $match stage to the pipeline.

Match<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, Expression<Func<TOutput, bool>>)

Appends a match stage to the pipeline.

Merge<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, IMongoCollection<TOutput>, MergeStageOptions<TOutput>)

Appends a $merge stage to the pipeline.

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

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

Out<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, IMongoCollection<TOutput>, TimeSeriesOptions)

Appends a $out stage to the pipeline.

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

Appends a project stage to the pipeline.

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

Appends a $project stage to the pipeline.

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

Appends a project stage to the pipeline.

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

Appends a $replaceRoot stage to the pipeline.

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

Appends a $replaceRoot stage to the pipeline.

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

Appends a $replaceWith stage to the pipeline.

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

Appends a $replaceWith stage to the pipeline.

Sample<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, long)

Appends a $sample stage to the pipeline.

SearchMeta<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, SearchDefinition<TOutput>, string, SearchCountOptions)

Appends a $searchMeta stage to the pipeline.

Search<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, SearchDefinition<TOutput>, SearchHighlightOptions<TOutput>, string, SearchCountOptions, bool, bool)

Appends a $search stage to the pipeline.

Search<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, SearchDefinition<TOutput>, SearchOptions<TOutput>)

Appends a $search stage to the pipeline.

SetWindowFields<TInput, TIntermediate, TWindowFields>(PipelineDefinition<TInput, TIntermediate>, AggregateExpressionDefinition<ISetWindowFieldsPartition<TIntermediate>, TWindowFields>)

Create a $setWindowFields stage.

SetWindowFields<TInput, TIntermediate, TPartitionBy, TWindowFields>(PipelineDefinition<TInput, TIntermediate>, AggregateExpressionDefinition<TIntermediate, TPartitionBy>, AggregateExpressionDefinition<ISetWindowFieldsPartition<TIntermediate>, TWindowFields>)

Appends a $setWindowFields stage to the pipeline.

SetWindowFields<TInput, TIntermediate, TPartitionBy, TWindowFields>(PipelineDefinition<TInput, TIntermediate>, AggregateExpressionDefinition<TIntermediate, TPartitionBy>, SortDefinition<TIntermediate>, AggregateExpressionDefinition<ISetWindowFieldsPartition<TIntermediate>, TWindowFields>)

Appends a $setWindowFields stage to the pipeline.

SetWindowFields<TInput, TIntermediate, TPartitionBy, TWindowFields>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<ISetWindowFieldsPartition<TIntermediate>, TWindowFields>>)

Appends a $setWindowFields stage to the pipeline.

SetWindowFields<TInput, TIntermediate, TPartitionBy, TWindowFields>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TPartitionBy>>, SortDefinition<TIntermediate>, Expression<Func<ISetWindowFieldsPartition<TIntermediate>, TWindowFields>>)

Appends a $setWindowFields stage to the pipeline.

SetWindowFields<TInput, TIntermediate, TPartitionBy, TWindowFields>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TPartitionBy>>, Expression<Func<ISetWindowFieldsPartition<TIntermediate>, TWindowFields>>)

Appends a $setWindowFields stage to the pipeline.

Set<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, SetFieldDefinitions<TOutput>)

Appends a $set stage to the pipeline.

Set<TInput, TOutput, TFields>(PipelineDefinition<TInput, TOutput>, Expression<Func<TOutput, TFields>>)

Appends a $set stage to the pipeline.

Skip<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, long)

Appends a $skip stage to the pipeline.

SortByCount<TInput, TIntermediate, TValue>(PipelineDefinition<TInput, TIntermediate>, AggregateExpressionDefinition<TIntermediate, TValue>)

Appends a $sortByCount stage to the pipeline.

SortByCount<TInput, TIntermediate, TValue>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, TValue>>)

Appends a sortByCount stage to the pipeline.

Sort<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, SortDefinition<TOutput>)

Appends a $sort stage to the pipeline.

UnionWith<TInput, TWith, TOutput>(PipelineDefinition<TInput, TOutput>, IMongoCollection<TWith>, PipelineDefinition<TWith, TOutput>)

Appends a $unionWith stage to the pipeline.

Unwind<TInput, TIntermediate>(PipelineDefinition<TInput, TIntermediate>, FieldDefinition<TIntermediate>, AggregateUnwindOptions<BsonDocument>)

Appends an unwind stage to the pipeline.

Unwind<TInput, TIntermediate>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, object>>, AggregateUnwindOptions<BsonDocument>)

Appends an unwind stage to the pipeline.

Unwind<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, FieldDefinition<TIntermediate>, AggregateUnwindOptions<TOutput>)

Appends an $unwind stage to the pipeline.

Unwind<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, Expression<Func<TIntermediate, object>>, AggregateUnwindOptions<TOutput>)

Appends an unwind stage to the pipeline.

VectorSearch<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, FieldDefinition<TOutput>, QueryVector, int, VectorSearchOptions<TOutput>)

Appends a $vectorSearch stage to the pipeline.

VectorSearch<TInput, TField, TOutput>(PipelineDefinition<TInput, TOutput>, Expression<Func<TOutput, TField>>, QueryVector, int, VectorSearchOptions<TOutput>)

Appends a $vectorSearch stage to the pipeline.