Table of Contents

Method Search

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Search<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, SearchDefinition<TOutput>, SearchHighlightOptions<TOutput>, string, SearchCountOptions, bool, bool)

Appends a $search stage to the pipeline.

public static PipelineDefinition<TInput, TOutput> Search<TInput, TOutput>(this PipelineDefinition<TInput, TOutput> pipeline, SearchDefinition<TOutput> searchDefinition, SearchHighlightOptions<TOutput> highlight = null, string indexName = null, SearchCountOptions count = null, bool returnStoredSource = false, bool scoreDetails = false)

Parameters

pipeline PipelineDefinition<TInput, TOutput>

The pipeline.

searchDefinition SearchDefinition<TOutput>

The search definition.

highlight SearchHighlightOptions<TOutput>

The highlight options.

indexName string

The index name.

count SearchCountOptions

The count options.

returnStoredSource bool

Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search.

scoreDetails bool

Flag that specifies whether to return a detailed breakdown of the score for each document in the result.

Returns

PipelineDefinition<TInput, TOutput>

A new pipeline with an additional stage.

Type Parameters

TInput

The type of the input documents.

TOutput

The type of the output documents.

Search<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, SearchDefinition<TOutput>, SearchOptions<TOutput>)

Appends a $search stage to the pipeline.

public static PipelineDefinition<TInput, TOutput> Search<TInput, TOutput>(this PipelineDefinition<TInput, TOutput> pipeline, SearchDefinition<TOutput> searchDefinition, SearchOptions<TOutput> searchOptions)

Parameters

pipeline PipelineDefinition<TInput, TOutput>

The pipeline.

searchDefinition SearchDefinition<TOutput>

The search definition.

searchOptions SearchOptions<TOutput>

The search options.

Returns

PipelineDefinition<TInput, TOutput>

A new pipeline with an additional stage.

Type Parameters

TInput

The type of the input documents.

TOutput

The type of the output documents.

Search<TInput, TIntermediate, TOutput>(PipelineDefinition<TInput, TIntermediate>, SearchDefinition<TIntermediate>, FieldDefinition<TIntermediate, IEnumerable<TOutput>>, SearchOptions<TIntermediate>)

Appends a $search stage to the pipeline.

public static PipelineDefinition<TInput, TOutput> Search<TInput, TIntermediate, TOutput>(this PipelineDefinition<TInput, TIntermediate> pipeline, SearchDefinition<TIntermediate> searchDefinition, FieldDefinition<TIntermediate, IEnumerable<TOutput>> returnScope, SearchOptions<TIntermediate> searchOptions)

Parameters

pipeline PipelineDefinition<TInput, TIntermediate>

The pipeline.

searchDefinition SearchDefinition<TIntermediate>

The search definition.

returnScope FieldDefinition<TIntermediate, IEnumerable<TOutput>>

The level of nested documents to return.

searchOptions SearchOptions<TIntermediate>

The search options.

Returns

PipelineDefinition<TInput, TOutput>

A new pipeline with an additional stage.

Type Parameters

TInput

The type of the input documents.

TIntermediate

The type of the intermediate documents.

TOutput

The type of the output documents.