Table of Contents

Method VectorSearch

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

VectorSearch<TInput, TField, TOutput>(PipelineDefinition<TInput, TOutput>, Expression<Func<TOutput, TField>>, QueryVector, int, VectorSearchOptions<TOutput>)

Appends a $vectorSearch stage to the pipeline.

public static PipelineDefinition<TInput, TOutput> VectorSearch<TInput, TField, TOutput>(this PipelineDefinition<TInput, TOutput> pipeline, Expression<Func<TOutput, TField>> field, QueryVector queryVector, int limit, VectorSearchOptions<TOutput> options = null)

Parameters

pipeline PipelineDefinition<TInput, TOutput>

The pipeline.

field Expression<Func<TOutput, TField>>

The field.

queryVector QueryVector

The query vector.

limit int

The limit.

options VectorSearchOptions<TOutput>

The vector search options.

Returns

PipelineDefinition<TInput, TOutput>

A new pipeline with an additional stage.

Type Parameters

TInput

The type of the input.

TField

The type of the field.

TOutput

The type of the output.

VectorSearch<TInput, TOutput>(PipelineDefinition<TInput, TOutput>, FieldDefinition<TOutput>, QueryVector, int, VectorSearchOptions<TOutput>)

Appends a $vectorSearch stage to the pipeline.

public static PipelineDefinition<TInput, TOutput> VectorSearch<TInput, TOutput>(this PipelineDefinition<TInput, TOutput> pipeline, FieldDefinition<TOutput> field, QueryVector queryVector, int limit, VectorSearchOptions<TOutput> options = null)

Parameters

pipeline PipelineDefinition<TInput, TOutput>

The pipeline.

field FieldDefinition<TOutput>

The field.

queryVector QueryVector

The query vector.

limit int

The limit.

options VectorSearchOptions<TOutput>

The vector search options.

Returns

PipelineDefinition<TInput, TOutput>

A new pipeline with an additional stage.

Type Parameters

TInput

The type of the input.

TOutput

The type of the output.