Table of Contents

Method Lookup

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

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

Creates a $lookup stage.

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

Parameters

foreignCollection IMongoCollection<TForeignDocument>

The foreign collection.

localField FieldDefinition<TInput>

The local field.

foreignField FieldDefinition<TForeignDocument>

The foreign field.

as FieldDefinition<TOutput>

The "as" field.

options AggregateLookupOptions<TForeignDocument, TOutput>

The options.

Returns

PipelineStageDefinition<TInput, TOutput>

The stage.

Type Parameters

TInput

The type of the input documents.

TForeignDocument

The type of the foreign collection documents.

TOutput

The type of the output documents.

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

Creates a $lookup stage.

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

Parameters

foreignCollection IMongoCollection<TForeignDocument>

The foreign collection.

localField Expression<Func<TInput, 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

PipelineStageDefinition<TInput, TOutput>

The stage.

Type Parameters

TInput

The type of the input documents.

TForeignDocument

The type of the foreign collection documents.

TOutput

The type of the output documents.

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

Creates a $lookup stage.

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

Parameters

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

PipelineStageDefinition<TInput, TOutput>

The stage.

Type Parameters

TInput

The type of the input 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, TForeignDocument, TAsElement, TAs, TOutput>(IMongoCollection<TForeignDocument>, BsonDocument, PipelineDefinition<TForeignDocument, TAsElement>, Expression<Func<TOutput, TAs>>, AggregateLookupOptions<TForeignDocument, TOutput>)

Creates a $lookup stage.

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

Parameters

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

PipelineStageDefinition<TInput, TOutput>

The stage.

Type Parameters

TInput

The type of the input 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.