Table of Contents

Method Lookup

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Lookup<TForeignDocument, TNewResult>(string, FieldDefinition<TResult>, FieldDefinition<TForeignDocument>, FieldDefinition<TNewResult>, AggregateLookupOptions<TForeignDocument, TNewResult>)

Appends a lookup stage to the pipeline.

public virtual IAggregateFluent<TNewResult> Lookup<TForeignDocument, TNewResult>(string foreignCollectionName, FieldDefinition<TResult> localField, FieldDefinition<TForeignDocument> foreignField, FieldDefinition<TNewResult> @as, AggregateLookupOptions<TForeignDocument, TNewResult> options)

Parameters

foreignCollectionName string

Name of the other collection.

localField FieldDefinition<TResult>

The local field.

foreignField FieldDefinition<TForeignDocument>

The foreign field.

as FieldDefinition<TNewResult>

The field in TNewResult to place the foreign results.

options AggregateLookupOptions<TForeignDocument, TNewResult>

The options.

Returns

IAggregateFluent<TNewResult>

The fluent aggregate interface.

Type Parameters

TForeignDocument

The type of the foreign document.

TNewResult

The type of the new result.

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

Appends a lookup stage to the pipeline.

public virtual IAggregateFluent<TNewResult> Lookup<TForeignDocument, TAsElement, TAs, TNewResult>(IMongoCollection<TForeignDocument> foreignCollection, BsonDocument let, PipelineDefinition<TForeignDocument, TAsElement> lookupPipeline, FieldDefinition<TNewResult, TAs> @as, AggregateLookupOptions<TForeignDocument, TNewResult> 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<TNewResult, TAs>

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

options AggregateLookupOptions<TForeignDocument, TNewResult>

The options.

Returns

IAggregateFluent<TNewResult>

The fluent aggregate interface.

Type Parameters

TForeignDocument

The type of the foreign collection documents.

TAsElement

The type of the as field elements.

TAs

The type of the as field.

TNewResult

The type of the new result.