My Library Docs

Multi-root Sidebar

flex-layout

  • Getting Started

  • Guides

  • Reference

typed-rx-http

  • Getting Started

  • Guides

  • Reference

global-rx-state

  • Getting Started

  • Guides

  • Reference

webflux-fe-dev-assistant

reactive-mongo-dsl

Vector Search

Describes the manual/automated embedding query, ANN/ENN, pre/post filter, Driver 5.10 nested vector options, and Bson extension paths for Vector Search.


Basic Vector Search.
java

Vector Search requires an explicit index name, and $vectorSearch becomes the first stage of the aggregation.

Query vector / Automated Embedding.

queryVector(float[]/double[]/Collection<Double>)

Passes the vector generated by the application.

queryVector(BinaryVector).

Directly uses the compact binary vector representation of the MongoDB Driver.

query(String).

Passes the query text itself to the MongoDB Automated Embedding index.

query(VectorSearchQuery).

A future-compatible escape hatch for directly passing the driver-native query type.

java

The DSL core does not include the ability to call external embedding providers to generate vectors. Manual vectors are generated by the calling application and passed to queryVector(...).

ANN / ENN.

ANN.

Use approximate(numCandidates) or numCandidates(...). The candidate count is required for ANN.

ENN.

Use exact() or exact(true). Activating exact removes the existing numCandidates value.

Pre-filter / post-filter.
java

filter()/filterFields().

Pre-filter that affects candidate selection itself, which goes into $vectorSearch.filter.

fields(...).

General $match post-filter after $vectorSearch.

Nested / array embedding (Driver 5.10).
java

filter / filterFields.

Filter for the leaf document of nested embedding.

parentFilter / parentFilterFields.

This is the parentFilter applied to the root document in Driver 5.10.

nestedScoreMode

Combines multiple matching embedding scores of a document using AVG or MAX.

Score / projection / terminal
java

findAll / find

Returns the vector result as Flux/Mono.

count().execute()

Counts the number of results in the pipeline after the vector limit. It is not the total count of the corpus.

existsQuery().execute()

Checks if there are vector pipeline results.

Driver-native post stage / options
java

stage(Bson) is executed immediately after $vectorSearch, before post-filter/metadata/projection. driverOptions(...) is an escape hatch to use current/future Driver options that are not yet available in the convenience API.

© 2026 Byeolnaerim. All rights reserved.IntroductionPrivacy Policy