Przejdź do głównej zawartości

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

Implements

Constructors

new MongoDBAtlasVectorSearch()

new MongoDBAtlasVectorSearch(init): MongoDBAtlasVectorSearch

Parameters

init: Partial <MongoDBAtlasVectorSearch> & object

Returns

MongoDBAtlasVectorSearch

Overrides

VectorStoreBase . constructor

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:97

Properties

collection

private collection: Collection<Document>

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:95


embedModel

embedModel: BaseEmbedding

Inherited from

VectorStoreBase . embedModel

Source

packages/llamaindex/src/storage/vectorStore/types.ts:86


embeddingKey

embeddingKey: string

Name of the key containing the embedding vector.

Default: "embedding"

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:55


flatMetadata

flatMetadata: boolean = true

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:36


idKey

idKey: string

Name of the key containing the node id.

Default: "id"

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:62


indexName

indexName: string

Name of the vector index. If invalid, Mongo will silently ignore this issue and return 0 results.

Default: "default"

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:48


insertOptions?

optional insertOptions: BulkWriteOptions

Options to pass to the insertMany function when adding nodes.

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:81


metadataKey

metadataKey: string

Name of the key containing the node metadata.

Default: "metadata"

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:76


mongodbClient

mongodbClient: MongoClient

The used MongoClient. If not given, a new MongoClient is created based on the MONGODB_URI env variable.

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:41


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.

Vector Search Queries

and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs

Default: query.similarityTopK * 10

Parameters

query: VectorStoreQuery

Returns

number

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:94


storesText

storesText: boolean = true

Implementation of

VectorStoreNoEmbedModel . storesText

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:35


textKey

textKey: string

Name of the key containing the node text.

Default: "text"

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:69

Accessors

client

get client(): any

Returns

any

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:180

Methods

add()

add(nodes): Promise<string[]>

Add nodes to the vector store.

Parameters

nodes: BaseNode <Metadata>[]

Nodes to add to the vector store

Returns

Promise<string[]>

List of node ids that were added

Implementation of

VectorStoreNoEmbedModel . add

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:136


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?: any

Options to pass to the deleteOne function

Returns

Promise<void>

Implementation of

VectorStoreNoEmbedModel . delete

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:171


query()

query(query, options?): Promise <VectorStoreQueryResult>

Perform a vector similarity search query.

Parameters

query: VectorStoreQuery

The query to run

options?: any

Returns

Promise <VectorStoreQueryResult>

List of nodes and their similarities

Implementation of

VectorStoreNoEmbedModel . query

Source

packages/llamaindex/src/storage/vectorStore/MongoDBAtlasVectorStore.ts:190