Table of Contents

Method VectorSearch

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

VectorSearch<TSource, TField>(IMongoQueryable<TSource>, FieldDefinition<TSource>, QueryVector, int, VectorSearchOptions<TSource>)

Appends a $vectorSearch stage to the LINQ pipeline.

public static IMongoQueryable<TSource> VectorSearch<TSource, TField>(this IMongoQueryable<TSource> source, FieldDefinition<TSource> field, QueryVector queryVector, int limit, VectorSearchOptions<TSource> options = null)

Parameters

source IMongoQueryable<TSource>

A sequence of values.

field FieldDefinition<TSource>

The field.

queryVector QueryVector

The query vector.

limit int

The limit.

options VectorSearchOptions<TSource>

The options.

Returns

IMongoQueryable<TSource>

The queryable with a new stage appended.

Type Parameters

TSource

The type of the elements of source.

TField

The type of the field.

VectorSearch<TSource, TField>(IMongoQueryable<TSource>, Expression<Func<TSource, TField>>, QueryVector, int, VectorSearchOptions<TSource>)

Appends a $vectorSearch stage to the LINQ pipeline.

public static IMongoQueryable<TSource> VectorSearch<TSource, TField>(this IMongoQueryable<TSource> source, Expression<Func<TSource, TField>> field, QueryVector queryVector, int limit, VectorSearchOptions<TSource> options = null)

Parameters

source IMongoQueryable<TSource>

A sequence of values.

field Expression<Func<TSource, TField>>

The field.

queryVector QueryVector

The query vector.

limit int

The limit.

options VectorSearchOptions<TSource>

The options.

Returns

IMongoQueryable<TSource>

The queryable with a new stage appended.

Type Parameters

TSource

The type of the elements of source.

TField

The type of the field.