Table of Contents

Method Search

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Search<TResult, TNewResult>(IAggregateFluent<TResult>, SearchDefinition<TResult>, FieldDefinition<TResult, IEnumerable<TNewResult>>, SearchOptions<TResult>)

Appends a $search stage to the pipeline, returning documents from a nested scope.

public static IAggregateFluent<TNewResult> Search<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, SearchDefinition<TResult> searchDefinition, FieldDefinition<TResult, IEnumerable<TNewResult>> returnScope, SearchOptions<TResult> searchOptions = null)

Parameters

aggregate IAggregateFluent<TResult>

The aggregate.

searchDefinition SearchDefinition<TResult>

The search definition.

returnScope FieldDefinition<TResult, IEnumerable<TNewResult>>

The level of nested documents to return.

searchOptions SearchOptions<TResult>

The search options.

Returns

IAggregateFluent<TNewResult>

The fluent aggregate interface.

Type Parameters

TResult

The type of the result.

TNewResult

The type of the new result.

Search<TResult, TNewResult>(IAggregateFluent<TResult>, SearchDefinition<TResult>, Expression<Func<TResult, IEnumerable<TNewResult>>>, SearchOptions<TResult>)

Appends a $search stage to the pipeline, returning documents from a nested scope.

public static IAggregateFluent<TNewResult> Search<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, SearchDefinition<TResult> searchDefinition, Expression<Func<TResult, IEnumerable<TNewResult>>> returnScope, SearchOptions<TResult> searchOptions = null)

Parameters

aggregate IAggregateFluent<TResult>

The aggregate.

searchDefinition SearchDefinition<TResult>

The search definition.

returnScope Expression<Func<TResult, IEnumerable<TNewResult>>>

The level of nested documents to return.

searchOptions SearchOptions<TResult>

The search options.

Returns

IAggregateFluent<TNewResult>

The fluent aggregate interface.

Type Parameters

TResult

The type of the result.

TNewResult

The type of the new result.