Class: MongoDBAtlasVectorSearch
Vector store that uses MongoDB Atlas for storage and vector search. This store uses the $vectorSearch aggregation stage to perform vector similarity search.
Extends
Constructors
new MongoDBAtlasVectorSearch()
new MongoDBAtlasVectorSearch(
init
):MongoDBAtlasVectorSearch
Parameters
• init: Partial
<MongoDBAtlasVectorSearch
> & object
& VectorStoreBaseParams
Returns
Overrides
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:139
Properties
autoCreateIndex
autoCreateIndex:
boolean
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:76
collectionName
collectionName:
string
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:75
dbName
dbName:
string
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:74
embeddingDefinition
embeddingDefinition:
Record
<string
,unknown
>
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:77
embeddingKey
embeddingKey:
string
Name of the key containing the embedding vector.
Default: "embedding"
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:97
embedModel
embedModel:
BaseEmbedding
Inherited from
Defined in
packages/llamaindex/src/vector-store/types.ts:92
flatMetadata
flatMetadata:
boolean
=true
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:72
idKey
idKey:
string
Name of the key containing the node id.
Default: "id"
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:104
indexedMetadataFields
indexedMetadataFields:
string
[]
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:78
indexName
indexName:
string
Name of the vector index. If invalid, Mongo will silently ignore this issue and return 0 results.
Default: "default"
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:90
insertOptions?
optional
insertOptions:BulkWriteOptions
Options to pass to the insertMany function when adding nodes.
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:123
isEmbeddingQuery?
optional
isEmbeddingQuery:boolean
Inherited from
BaseVectorStore
.isEmbeddingQuery
Defined in
packages/llamaindex/src/vector-store/types.ts:94
metadataKey
metadataKey:
string
Name of the key containing the node metadata.
Default: "metadata"
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:118
mongodbClient
mongodbClient:
MongoClient
The used MongoClient. If not given, a new MongoClient is created based on the MONGODB_URI env variable.
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:83
numCandidates()
numCandidates: (
query
) =>number
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
• query: VectorStoreQuery
Returns
number
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:136
storesText
storesText:
boolean
=true
Overrides
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:71
textKey
textKey:
string
Name of the key containing the node text.
Default: "text"
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:111
Methods
add()
add(
nodes
):Promise
<string
[]>
Add nodes to the vector store.
Parameters
Nodes to add to the vector store
Returns
Promise
<string
[]>
List of node ids that were added
Overrides
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:223
client()
client():
MongoClient
Returns
MongoClient
Overrides
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:274
delete()
delete(
refDocId
,deleteOptions
?):Promise
<void
>
Delete nodes from the vector store with the given redDocId.
Parameters
• refDocId: string
The refDocId of the nodes to delete
• deleteOptions?: object
Options to pass to the deleteOne function
Returns
Promise
<void
>
Overrides
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:264
ensureCollection()
ensureCollection():
Promise
<Collection
<Document
>>
Returns
Promise
<Collection
<Document
>>
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:180
query()
query(
query
,options
?):Promise
<VectorStoreQueryResult
>
Perform a vector similarity search query.
Parameters
• query: VectorStoreQuery
The query to run
• options?: object
Returns
Promise
<VectorStoreQueryResult
>
List of nodes and their similarities
Overrides
Defined in
packages/llamaindex/src/vector-store/MongoDBAtlasVectorStore.ts:284