Table of Contents

Class ProjectionDefinitionBuilder<TSource>

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

A builder for a projection.

public sealed class ProjectionDefinitionBuilder<TSource>

Type Parameters

TSource

The type of the source.

Inheritance
ProjectionDefinitionBuilder<TSource>
Inherited Members

Methods

As<TProjection>(IBsonSerializer<TProjection>)

Creates a client side projection that is implemented solely by using a different serializer.

public ProjectionDefinition<TSource, TProjection> As<TProjection>(IBsonSerializer<TProjection> projectionSerializer = null)

Parameters

projectionSerializer IBsonSerializer<TProjection>

The projection serializer.

Returns

ProjectionDefinition<TSource, TProjection>

A client side deserialization projection.

Type Parameters

TProjection

The type of the projection.

Combine(params ProjectionDefinition<TSource>[])

Combines the specified projections.

public ProjectionDefinition<TSource> Combine(params ProjectionDefinition<TSource>[] projections)

Parameters

projections ProjectionDefinition<TSource>[]

The projections.

Returns

ProjectionDefinition<TSource>

A combined projection.

Combine(IEnumerable<ProjectionDefinition<TSource>>)

Combines the specified projections.

public ProjectionDefinition<TSource> Combine(IEnumerable<ProjectionDefinition<TSource>> projections)

Parameters

projections IEnumerable<ProjectionDefinition<TSource>>

The projections.

Returns

ProjectionDefinition<TSource>

A combined projection.

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.

Exclude(FieldDefinition<TSource>)

Creates a projection that excludes a field.

public ProjectionDefinition<TSource> Exclude(FieldDefinition<TSource> field)

Parameters

field FieldDefinition<TSource>

The field.

Returns

ProjectionDefinition<TSource>

An exclusion projection.

Exclude(Expression<Func<TSource, object>>)

Creates a projection that excludes a field.

public ProjectionDefinition<TSource> Exclude(Expression<Func<TSource, object>> field)

Parameters

field Expression<Func<TSource, object>>

The field.

Returns

ProjectionDefinition<TSource>

An exclusion projection.

Expression<TProjection>(Expression<Func<TSource, TProjection>>)

Creates a projection based on the expression.

public ProjectionDefinition<TSource, TProjection> Expression<TProjection>(Expression<Func<TSource, TProjection>> expression)

Parameters

expression Expression<Func<TSource, TProjection>>

The expression.

Returns

ProjectionDefinition<TSource, TProjection>

An expression projection.

Type Parameters

TProjection

The type of the result.

Include(FieldDefinition<TSource>)

Creates a projection that includes a field.

public ProjectionDefinition<TSource> Include(FieldDefinition<TSource> field)

Parameters

field FieldDefinition<TSource>

The field.

Returns

ProjectionDefinition<TSource>

An inclusion projection.

Include(Expression<Func<TSource, object>>)

Creates a projection that includes a field.

public ProjectionDefinition<TSource> Include(Expression<Func<TSource, object>> field)

Parameters

field Expression<Func<TSource, object>>

The field.

Returns

ProjectionDefinition<TSource>

An inclusion projection.

Meta(string, string)

Creates a meta projection.

public ProjectionDefinition<TSource> Meta(string field, string metaFieldName)

Parameters

field string

The field.

metaFieldName string

The meta field name.

Returns

ProjectionDefinition<TSource>

A text score projection.

MetaSearchHighlights(string)

Creates a search highlights projection.

public ProjectionDefinition<TSource> MetaSearchHighlights(string field)

Parameters

field string

The field.

Returns

ProjectionDefinition<TSource>

A search highlights projection.

MetaSearchScore(string)

Creates a search score projection.

public ProjectionDefinition<TSource> MetaSearchScore(string field)

Parameters

field string

The field.

Returns

ProjectionDefinition<TSource>

A search score projection.

MetaSearchScoreDetails(string)

Creates a search score details projection.

public ProjectionDefinition<TSource> MetaSearchScoreDetails(string field)

Parameters

field string

The field.

Returns

ProjectionDefinition<TSource>

A search score details projection.

MetaTextScore(string)

Creates a text score projection.

public ProjectionDefinition<TSource> MetaTextScore(string field)

Parameters

field string

The field.

Returns

ProjectionDefinition<TSource>

A text score projection.

SearchMeta(FieldDefinition<TSource>)

Creates a search metadata projection.

public ProjectionDefinition<TSource> SearchMeta(FieldDefinition<TSource> field)

Parameters

field FieldDefinition<TSource>

The field.

Returns

ProjectionDefinition<TSource>

A search metadata projection.

SearchMeta(Expression<Func<TSource, object>>)

Creates a search metadata projection.

public ProjectionDefinition<TSource> SearchMeta(Expression<Func<TSource, object>> field)

Parameters

field Expression<Func<TSource, object>>

The field.

Returns

ProjectionDefinition<TSource>

A search metadata projection.

Slice(FieldDefinition<TSource>, int)

Creates an array slice projection.

public ProjectionDefinition<TSource> Slice(FieldDefinition<TSource> field, int limit)

Parameters

field FieldDefinition<TSource>

The field.

limit int

The limit.

Returns

ProjectionDefinition<TSource>

An array slice projection.

Slice(FieldDefinition<TSource>, int, int)

Creates an array slice projection.

public ProjectionDefinition<TSource> Slice(FieldDefinition<TSource> field, int skip, int limit)

Parameters

field FieldDefinition<TSource>

The field.

skip int

The skip.

limit int

The limit.

Returns

ProjectionDefinition<TSource>

An array slice projection.

Slice(Expression<Func<TSource, object>>, int)

Creates an array slice projection.

public ProjectionDefinition<TSource> Slice(Expression<Func<TSource, object>> field, int limit)

Parameters

field Expression<Func<TSource, object>>

The field.

limit int

The limit.

Returns

ProjectionDefinition<TSource>

An array slice projection.

Slice(Expression<Func<TSource, object>>, int, int)

Creates an array slice projection.

public ProjectionDefinition<TSource> Slice(Expression<Func<TSource, object>> field, int skip, int limit)

Parameters

field Expression<Func<TSource, object>>

The field.

skip int

The skip.

limit int

The limit.

Returns

ProjectionDefinition<TSource>

An array slice projection.