Table of Contents

Method Join

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

Join<TOuter, TInner, TKey, TResult>(IMongoQueryable<TOuter>, IEnumerable<TInner>, Expression<Func<TOuter, TKey>>, Expression<Func<TInner, TKey>>, Expression<Func<TOuter, TInner, TResult>>)

Correlates the elements of two sequences based on matching keys.

public static IMongoQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IMongoQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector)

Parameters

outer IMongoQueryable<TOuter>

The first sequence to join.

inner IEnumerable<TInner>

The sequence to join to the first sequence.

outerKeySelector Expression<Func<TOuter, TKey>>

A function to extract the join key from each element of the first sequence.

innerKeySelector Expression<Func<TInner, TKey>>

A function to extract the join key from each element of the second sequence.

resultSelector Expression<Func<TOuter, TInner, TResult>>

A function to create a result element from two matching elements.

Returns

IMongoQueryable<TResult>

An IQueryable<T> that has elements of type TResult obtained by performing an inner join on two sequences.

Type Parameters

TOuter

The type of the elements of the first sequence.

TInner

The type of the elements of the second sequence.

TKey

The type of the keys returned by the key selector functions.

TResult

The type of the result elements.

Join<TOuter, TInner, TKey, TResult>(IMongoQueryable<TOuter>, IMongoCollection<TInner>, Expression<Func<TOuter, TKey>>, Expression<Func<TInner, TKey>>, Expression<Func<TOuter, TInner, TResult>>)

Correlates the elements of two sequences based on matching keys.

public static IMongoQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IMongoQueryable<TOuter> outer, IMongoCollection<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector)

Parameters

outer IMongoQueryable<TOuter>

The first sequence to join.

inner IMongoCollection<TInner>

The sequence to join to the first sequence.

outerKeySelector Expression<Func<TOuter, TKey>>

A function to extract the join key from each element of the first sequence.

innerKeySelector Expression<Func<TInner, TKey>>

A function to extract the join key from each element of the second sequence.

resultSelector Expression<Func<TOuter, TInner, TResult>>

A function to create a result element from two matching elements.

Returns

IMongoQueryable<TResult>

An IQueryable<T> that has elements of type TResult obtained by performing an inner join on two sequences.

Type Parameters

TOuter

The type of the elements of the first sequence.

TInner

The type of the elements of the second sequence.

TKey

The type of the keys returned by the key selector functions.

TResult

The type of the result elements.