/** * @module @nhtio/adk/batteries/vector/mongodb * * MongoDB Atlas Vector Search adapter. Each collection is a MongoDB collection with an Atlas * `vectorSearch` index on `vec`; KNN uses the `$vectorSearch` aggregation stage (cosine * `vectorSearchScore`, [0,1]). Metadata is a JSON string field filtered with the neutral filter * tree's JS reference evaluator for cross-adapter parity. * * Consistency note: the *document* collection is strongly consistent, but the Atlas vector * *index* updates asynchronously after a write (~1s). So filter-scans, fetch-by-id and the * delete read-back use a plain `find()` (immediate), and only KNN goes through `$vectorSearch` — * after which the adapter polls until the just-inserted ids are index-visible (strong mode). * * Driver: `mongodb`. Works against `mongodb/mongodb-atlas-local` or a real Atlas cluster. */ import { BaseVectorStore } from "../contract"; import type { SearchPlan, UpsertPlan, DeletePlan, CollectionSpec } from "../plan"; import type { VectorMatch, VectorStoreCapabilities, BaseVectorStoreOptions } from "../types"; export interface MongoDBVectorStoreOptions extends BaseVectorStoreOptions { /** Connection and authentication parameters for the backend. */ connection: { url: string; database?: string; /** * When set, the physical MongoDB collection becomes `${collectionPrefix}${collection}`. The * logical collection the builder/base see is unchanged. Lets callers (and the test suite) * isolate otherwise identically-named collections — useful because the Atlas vectorSearch * index builds asynchronously, so a fresh collection per use avoids drop+rebuild churn. */ collectionPrefix?: string; }; } export declare class MongoDBVectorStore extends BaseVectorStore { #private; readonly capabilities: VectorStoreCapabilities; /** Static availability probe: whether this adapter's runtime driver can load in the current environment. */ static isAvailable(): boolean; isAvailable(): boolean; connect(): Promise; close(): Promise; createCollection(spec: CollectionSpec, ifNotExists: boolean): Promise; dropCollection(collection: string, ifExists: boolean): Promise; hasCollection(collection: string): Promise; renameCollection(_from: string, _to: string): Promise; executeUpsert(plan: UpsertPlan): Promise; executeSearch(plan: SearchPlan): Promise; executeDelete(plan: DeletePlan): Promise; }