MongoDBAtlasVectorSearch
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:71
Vector store that uses MongoDB Atlas for storage and vector search. This store uses the $vectorSearch aggregation stage to perform vector similarity search.
Extends
Section titled “Extends”BaseVectorStore
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MongoDBAtlasVectorSearch(
init
):MongoDBAtlasVectorSearch
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:140
Parameters
Section titled “Parameters”Partial
<MongoDBAtlasVectorSearch
> & object
& VectorStoreBaseParams
Returns
Section titled “Returns”MongoDBAtlasVectorSearch
Overrides
Section titled “Overrides”BaseVectorStore.constructor
Properties
Section titled “Properties”storesText
Section titled “storesText”storesText:
boolean
=true
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:72
Overrides
Section titled “Overrides”BaseVectorStore.storesText
flatMetadata
Section titled “flatMetadata”flatMetadata:
boolean
=true
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:73
dbName
Section titled “dbName”dbName:
string
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:75
collectionName
Section titled “collectionName”collectionName:
string
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:76
autoCreateIndex
Section titled “autoCreateIndex”autoCreateIndex:
boolean
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:77
embeddingDefinition
Section titled “embeddingDefinition”embeddingDefinition:
Record
<string
,unknown
>
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:78
indexedMetadataFields
Section titled “indexedMetadataFields”indexedMetadataFields:
string
[]
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:79
mongodbClient
Section titled “mongodbClient”mongodbClient:
MongoClient
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:84
The used MongoClient. If not given, a new MongoClient is created based on the MONGODB_URI env variable.
indexName
Section titled “indexName”indexName:
string
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:91
Name of the vector index. If invalid, Mongo will silently ignore this issue and return 0 results.
Default: “default”
embeddingKey
Section titled “embeddingKey”embeddingKey:
string
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:98
Name of the key containing the embedding vector.
Default: “embedding”
idKey:
string
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:105
Name of the key containing the node id.
Default: “id”
textKey
Section titled “textKey”textKey:
string
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:112
Name of the key containing the node text.
Default: “text”
metadataKey
Section titled “metadataKey”metadataKey:
string
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:119
Name of the key containing the node metadata.
Default: “metadata”
insertOptions?
Section titled “insertOptions?”
optional
insertOptions:BulkWriteOptions
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:124
Options to pass to the insertMany function when adding nodes.
numCandidates()
Section titled “numCandidates()”numCandidates: (
query
) =>number
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:137
Function to determine the number of candidates to retrieve for a given query. In case your results are not good, you might tune this value.
Default: query.similarityTopK * 10
Parameters
Section titled “Parameters”VectorStoreQuery
Returns
Section titled “Returns”number
Methods
Section titled “Methods”ensureCollection()
Section titled “ensureCollection()”ensureCollection():
Promise
<Collection
<Document
>>
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:181
Returns
Section titled “Returns”Promise
<Collection
<Document
>>
add(
nodes
):Promise
<string
[]>
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:224
Add nodes to the vector store.
Parameters
Section titled “Parameters”BaseNode
<Metadata
>[]
Nodes to add to the vector store
Returns
Section titled “Returns”Promise
<string
[]>
List of node ids that were added
Overrides
Section titled “Overrides”BaseVectorStore.add
delete()
Section titled “delete()”delete(
refDocId
,deleteOptions?
):Promise
<void
>
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:265
Delete nodes from the vector store with the given redDocId.
Parameters
Section titled “Parameters”refDocId
Section titled “refDocId”string
The refDocId of the nodes to delete
deleteOptions?
Section titled “deleteOptions?”object
Options to pass to the deleteOne function
Returns
Section titled “Returns”Promise
<void
>
Overrides
Section titled “Overrides”BaseVectorStore.delete
client()
Section titled “client()”client():
MongoClient
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:275
Returns
Section titled “Returns”MongoClient
Overrides
Section titled “Overrides”BaseVectorStore.client
query()
Section titled “query()”query(
query
,options?
):Promise
<VectorStoreQueryResult
>
Defined in: .build/typescript/packages/providers/storage/mongodb/src/MongoDBAtlasVectorStore.ts:285
Perform a vector similarity search query.
Parameters
Section titled “Parameters”VectorStoreQuery
The query to run
options?
Section titled “options?”object
Returns
Section titled “Returns”Promise
<VectorStoreQueryResult
>
List of nodes and their similarities
Overrides
Section titled “Overrides”BaseVectorStore.query