Table of Contents

Method Search

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

Search<TSource>(IMongoQueryable<TSource>, SearchDefinition<TSource>, SearchHighlightOptions<TSource>, string, SearchCountOptions, bool, bool)

Appends a $search stage to the LINQ pipeline.

public static IMongoQueryable<TSource> Search<TSource>(this IMongoQueryable<TSource> source, SearchDefinition<TSource> searchDefinition, SearchHighlightOptions<TSource> highlight = null, string indexName = null, SearchCountOptions count = null, bool returnStoredSource = false, bool scoreDetails = false)

Parameters

source IMongoQueryable<TSource>

A sequence of values.

searchDefinition SearchDefinition<TSource>

The search definition.

highlight SearchHighlightOptions<TSource>

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

IMongoQueryable<TSource>

The queryable with a new stage appended.

Type Parameters

TSource

The type of the elements of source.

Search<TSource>(IMongoQueryable<TSource>, SearchDefinition<TSource>, SearchOptions<TSource>)

Appends a $search stage to the LINQ pipeline.

public static IMongoQueryable<TSource> Search<TSource>(this IMongoQueryable<TSource> source, SearchDefinition<TSource> searchDefinition, SearchOptions<TSource> searchOptions)

Parameters

source IMongoQueryable<TSource>

A sequence of values.

searchDefinition SearchDefinition<TSource>

The search definition.

searchOptions SearchOptions<TSource>

The search options.

Returns

IMongoQueryable<TSource>

The queryable with a new stage appended.

Type Parameters

TSource

The type of the elements of source.