Table of Contents

Method ElemMatch

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

ElemMatch<TItem>(FieldDefinition<TSource>, FilterDefinition<TItem>)

Creates a projection that filters the contents of an array.

public ProjectionDefinition<TSource> ElemMatch<TItem>(FieldDefinition<TSource> field, FilterDefinition<TItem> filter)

Parameters

field FieldDefinition<TSource>

The field.

filter FilterDefinition<TItem>

The filter.

Returns

ProjectionDefinition<TSource>

An array filtering projection.

Type Parameters

TItem

The type of the item.

ElemMatch<TItem>(Expression<Func<TSource, IEnumerable<TItem>>>, FilterDefinition<TItem>)

Creates a projection that filters the contents of an array.

public ProjectionDefinition<TSource> ElemMatch<TItem>(Expression<Func<TSource, IEnumerable<TItem>>> field, FilterDefinition<TItem> filter)

Parameters

field Expression<Func<TSource, IEnumerable<TItem>>>

The field.

filter FilterDefinition<TItem>

The filter.

Returns

ProjectionDefinition<TSource>

An array filtering projection.

Type Parameters

TItem

The type of the item.

ElemMatch<TItem>(Expression<Func<TSource, IEnumerable<TItem>>>, Expression<Func<TItem, bool>>)

Creates a projection that filters the contents of an array.

public ProjectionDefinition<TSource> ElemMatch<TItem>(Expression<Func<TSource, IEnumerable<TItem>>> field, Expression<Func<TItem, bool>> filter)

Parameters

field Expression<Func<TSource, IEnumerable<TItem>>>

The field.

filter Expression<Func<TItem, bool>>

The filter.

Returns

ProjectionDefinition<TSource>

An array filtering projection.

Type Parameters

TItem

The type of the item.