Table of Contents

Method Lookup

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

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.

public static PipelineDefinition<TInput, TOutput> Lookup<TInput, TIntermediate, TForeignDocument, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, IMongoCollection<TForeignDocument> foreignCollection, FieldDefinition<TIntermediate> localField, FieldDefinition<TForeignDocument> foreignField, FieldDefinition<TOutput> @as, AggregateLookupOptions<TForeignDocument, TOutput> options = null)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

foreignCollection IMongoCollection<TForeignDocument>

The foreign collection.

localField FieldDefinition<TIntermediate>

The local field.

foreignField FieldDefinition<TForeignDocument>

The foreign field.

as FieldDefinition<TOutput>

The "as" field.

options AggregateLookupOptions<TForeignDocument, TOutput>

The 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.

TForeignDocument

The type of the foreign collection documents.

TOutput

The type of the output documents.

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.

public static PipelineDefinition<TInput, TOutput> Lookup<TInput, TIntermediate, TForeignDocument, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, IMongoCollection<TForeignDocument> foreignCollection, Expression<Func<TIntermediate, object>> localField, Expression<Func<TForeignDocument, object>> foreignField, Expression<Func<TOutput, object>> @as, AggregateLookupOptions<TForeignDocument, TOutput> options = null)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

foreignCollection IMongoCollection<TForeignDocument>

The foreign collection.

localField Expression<Func<TIntermediate, object>>

The local field.

foreignField Expression<Func<TForeignDocument, object>>

The foreign field.

as Expression<Func<TOutput, object>>

The "as" field.

options AggregateLookupOptions<TForeignDocument, TOutput>

The 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.

TForeignDocument

The type of the foreign collection documents.

TOutput

The type of the output documents.

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.

public static PipelineDefinition<TInput, TOutput> Lookup<TInput, TIntermediate, TForeignDocument, TAsElement, TAs, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, IMongoCollection<TForeignDocument> foreignCollection, BsonDocument let, PipelineDefinition<TForeignDocument, TAsElement> lookupPipeline, FieldDefinition<TOutput, TAs> @as, AggregateLookupOptions<TForeignDocument, TOutput> options = null) where TAs : IEnumerable<TAsElement>

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

foreignCollection IMongoCollection<TForeignDocument>

The foreign collection.

let BsonDocument

The "let" definition.

lookupPipeline PipelineDefinition<TForeignDocument, TAsElement>

The lookup pipeline.

as FieldDefinition<TOutput, TAs>

The as field in TOutput in which to place the results of the lookup pipeline.

options AggregateLookupOptions<TForeignDocument, TOutput>

The 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.

TForeignDocument

The type of the foreign collection documents.

TAsElement

The type of the as field elements.

TAs

The type of the as field.

TOutput

The type of the output documents.

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.

public static PipelineDefinition<TInput, TOutput> Lookup<TInput, TIntermediate, TForeignDocument, TAsElement, TAs, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, IMongoCollection<TForeignDocument> foreignCollection, BsonDocument let, PipelineDefinition<TForeignDocument, TAsElement> lookupPipeline, Expression<Func<TOutput, TAs>> @as, AggregateLookupOptions<TForeignDocument, TOutput> options = null) where TAs : IEnumerable<TAsElement>

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

foreignCollection IMongoCollection<TForeignDocument>

The foreign collection.

let BsonDocument

The "let" definition.

lookupPipeline PipelineDefinition<TForeignDocument, TAsElement>

The lookup pipeline.

as Expression<Func<TOutput, TAs>>

The as field in TOutput in which to place the results of the lookup pipeline.

options AggregateLookupOptions<TForeignDocument, TOutput>

The 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.

TForeignDocument

The type of the foreign collection documents.

TAsElement

The type of the as field elements.

TAs

The type of the as field.

TOutput

The type of the output documents.