Table of Contents

Method Lookup

Namespace
MongoDB.Driver.Linq
Assembly
MongoDB.Driver.dll

Lookup<TSource, TForeign, TField>(IQueryable<TSource>, IMongoCollection<TForeign>, Expression<Func<TSource, TField>>, Expression<Func<TForeign, TField>>)

Looks up documents in a foreign collection.

public static IQueryable<LookupResult<TSource, TForeign>> Lookup<TSource, TForeign, TField>(this IQueryable<TSource> source, IMongoCollection<TForeign> from, Expression<Func<TSource, TField>> localField, Expression<Func<TForeign, TField>> foreignField)

Parameters

source IQueryable<TSource>

The source documents.

from IMongoCollection<TForeign>

The foreign collection.

localField Expression<Func<TSource, TField>>

The local field to compare against the foreign field.

foreignField Expression<Func<TForeign, TField>>

The foreign field to compare against the local field.

Returns

IQueryable<LookupResult<TSource, TForeign>>

An IQueryable{LookupResult{TSource,TForeign}} with the results of the Lookup.

Type Parameters

TSource

The type of the source documents.

TForeign

The type of the foreign documents.

TField

The type of the fields being compared.

Lookup<TSource, TForeign, TResult>(IQueryable<TSource>, IMongoCollection<TForeign>, Expression<Func<TSource, IQueryable<TForeign>, IQueryable<TResult>>>)

Looks up documents in a foreign collection.

public static IQueryable<LookupResult<TSource, TResult>> Lookup<TSource, TForeign, TResult>(this IQueryable<TSource> source, IMongoCollection<TForeign> from, Expression<Func<TSource, IQueryable<TForeign>, IQueryable<TResult>>> pipeline)

Parameters

source IQueryable<TSource>

The source documents.

from IMongoCollection<TForeign>

The foreign collection.

pipeline Expression<Func<TSource, IQueryable<TForeign>, IQueryable<TResult>>>

The pipeline to run against the foreign documents.

Returns

IQueryable<LookupResult<TSource, TResult>>

An IQueryable{LookupResult{TSource,TResult}} with the results of the Lookup.

Type Parameters

TSource

The type of the source documents.

TForeign

The type of the foreign documents.

TResult

The type of the pipeline output.

Lookup<TSource, TForeign, TField, TResult>(IQueryable<TSource>, IMongoCollection<TForeign>, Expression<Func<TSource, TField>>, Expression<Func<TForeign, TField>>, Expression<Func<TSource, IQueryable<TForeign>, IQueryable<TResult>>>)

Looks up documents in a foreign collection.

public static IQueryable<LookupResult<TSource, TResult>> Lookup<TSource, TForeign, TField, TResult>(this IQueryable<TSource> source, IMongoCollection<TForeign> from, Expression<Func<TSource, TField>> localField, Expression<Func<TForeign, TField>> foreignField, Expression<Func<TSource, IQueryable<TForeign>, IQueryable<TResult>>> pipeline)

Parameters

source IQueryable<TSource>

The source documents.

from IMongoCollection<TForeign>

The foreign collection.

localField Expression<Func<TSource, TField>>

The local field to compare against the foreign field.

foreignField Expression<Func<TForeign, TField>>

The foreign field to compare against the local field.

pipeline Expression<Func<TSource, IQueryable<TForeign>, IQueryable<TResult>>>

The pipeline to run against the matching foreign documents.

Returns

IQueryable<LookupResult<TSource, TResult>>

An IQueryable{LookupResult{TSource,TResult}} with the results of the Lookup.

Type Parameters

TSource

The type of the source documents.

TForeign

The type of the foreign documents.

TField

The type of the fields being compared.

TResult

The type of the pipeline output.

Lookup<TSource, TDocument, TField>(IQueryable<TSource>, Expression<Func<TSource, IEnumerable<TDocument>>>, Expression<Func<TSource, TField>>, Expression<Func<TDocument, TField>>)

Looks up documents in a list of foreign documents.

public static IQueryable<LookupResult<TSource, TDocument>> Lookup<TSource, TDocument, TField>(this IQueryable<TSource> source, Expression<Func<TSource, IEnumerable<TDocument>>> documents, Expression<Func<TSource, TField>> localField, Expression<Func<TDocument, TField>> foreignField)

Parameters

source IQueryable<TSource>

The source documents.

documents Expression<Func<TSource, IEnumerable<TDocument>>>

The foreign documents.

localField Expression<Func<TSource, TField>>

The local field to compare against the foreign field.

foreignField Expression<Func<TDocument, TField>>

The foreign field to compare against the local field.

Returns

IQueryable<LookupResult<TSource, TDocument>>

An IQueryable{LookupResult{TSource,TDocument}} with the results of the Lookup.

Type Parameters

TSource

The type of the source documents.

TDocument

The type of the foreign documents.

TField

The type of the fields being compared.

Lookup<TSource, TDocument, TResult>(IQueryable<TSource>, Expression<Func<TSource, IEnumerable<TDocument>>>, Expression<Func<TSource, IQueryable<TDocument>, IQueryable<TResult>>>)

Looks up documents in a list of foreign documents.

public static IQueryable<LookupResult<TSource, TResult>> Lookup<TSource, TDocument, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, IEnumerable<TDocument>>> documents, Expression<Func<TSource, IQueryable<TDocument>, IQueryable<TResult>>> pipeline)

Parameters

source IQueryable<TSource>

The source documents.

documents Expression<Func<TSource, IEnumerable<TDocument>>>

The foreign documents.

pipeline Expression<Func<TSource, IQueryable<TDocument>, IQueryable<TResult>>>

The pipeline to run against the foreign documents.

Returns

IQueryable<LookupResult<TSource, TResult>>

An IQueryable{LookupResult{TSource,TResult}} with the results of the Lookup.

Type Parameters

TSource

The type of the source documents.

TDocument

The type of the foreign documents.

TResult

The type of the pipeline output.

Lookup<TSource, TDocument, TField, TResult>(IQueryable<TSource>, Expression<Func<TSource, IEnumerable<TDocument>>>, Expression<Func<TSource, TField>>, Expression<Func<TDocument, TField>>, Expression<Func<TSource, IQueryable<TDocument>, IQueryable<TResult>>>)

Looks up documents in a list of foreign documents.

public static IQueryable<LookupResult<TSource, TResult>> Lookup<TSource, TDocument, TField, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, IEnumerable<TDocument>>> documents, Expression<Func<TSource, TField>> localField, Expression<Func<TDocument, TField>> foreignField, Expression<Func<TSource, IQueryable<TDocument>, IQueryable<TResult>>> pipeline)

Parameters

source IQueryable<TSource>

The source documents.

documents Expression<Func<TSource, IEnumerable<TDocument>>>

The foreign documents.

localField Expression<Func<TSource, TField>>

The local field to compare against the foreign field.

foreignField Expression<Func<TDocument, TField>>

The foreign field to compare against the local field.

pipeline Expression<Func<TSource, IQueryable<TDocument>, IQueryable<TResult>>>

The pipeline to run against the matching foreign documents.

Returns

IQueryable<LookupResult<TSource, TResult>>

An IQueryable{LookupResult{TSource,TResult}} with the results of the Lookup.

Type Parameters

TSource

The type of the source documents.

TDocument

The type of the foreign documents.

TField

The type of the fields being matched.

TResult

The type of the pipeline output.