ByteChef LogoByteChef

MongoDB Atlas Vector Search

MongoDB Atlas Vector Search combines document storage with vector similarity search, enabling storage and retrieval of high-dimensional embeddings for AI and machine learning applications.

Categories: Artificial Intelligence

Type: mongodbAtlas/v1


Connections

Version: 1

custom

Properties

NameLabelTypeDescriptionRequired
connectionStringConnection StringSTRINGThe MongoDB Atlas connection string, e.g. mongodb+srv://cluster0.example.mongodb.net.true
databaseNameDatabase NameSTRINGThe name of the database to store the vectors in.true
usernameUsernameSTRINGUsername for authentication with MongoDB Atlas.false
passwordPasswordSTRINGPassword for authentication with MongoDB Atlas.false
collectionNameCollection NameSTRINGThe name of the collection to store the vectors in.false
indexNameVector Index NameSTRINGThe name of the Atlas Vector Search index.false
pathNamePath NameSTRINGThe path where the embeddings are stored within the document.false
numCandidatesNumber of CandidatesINTEGERThe number of candidates to consider during approximate nearest neighbor search.false
metadataFieldsMetadata Fields To FilterSTRINGA comma-separated list of metadata fields that can be used to filter search results.false
initializeSchemaInitialize SchemaBOOLEAN
Options true, false
Whether to initialize the collection and the vector search index.false

Connection Setup

Official documentation

Step-by-step guide:

  1. Create a MongoDB Atlas cluster running MongoDB 6.0.11, 7.0.2, or later, with Vector Search enabled.
  2. Go to Database Access and create a database user (username and password).
  3. Go to Network Access and allow your current IP address.
  4. Go to Database → Connect → Drivers and copy the connection string (it looks like mongodb+srv://cluster0.example.mongodb.net).
  5. Create the database and collection that will store the vectors.
  6. Create an Atlas Vector Search index on the collection, or enable Initialize Schema to have it created automatically.

Now you have the Connection String, Database Name, Username, Password, Collection Name and Vector Index Name and can create a connection.


Actions

Delete Documents

Name: delete

Delete documents from the vector store by metadata

Properties

NameLabelTypeDescriptionRequired
metadataMetadataARRAY
Items [{}]
List of metadata key-value pairs to filter by.false

Example JSON Structure

{
  "label" : "Delete Documents",
  "name" : "delete",
  "parameters" : {
    "metadata" : [ { } ]
  },
  "type" : "mongodbAtlas/v1/delete"
}

Output

This action does not produce any output.

Load Documents

Name: load

Loads documents into the vector store using LLM embeddings.

Properties

NameLabelTypeDescriptionRequired
metadataMetadataARRAY
Items [{}]
List of metadata key-value pairs to filter by.false

Example JSON Structure

{
  "label" : "Load Documents",
  "name" : "load",
  "parameters" : {
    "metadata" : [ { } ]
  },
  "type" : "mongodbAtlas/v1/load"
}

Output

This action does not produce any output.

Search Documents

Name: search

Query documents from the vector store using LLM embeddings.

Properties

NameLabelTypeDescriptionRequired
queryQuerySTRINGThe query to be executed.true
metadataMetadataARRAY
Items [{}]
List of metadata key-value pairs to filter by.false
topKTop KINTEGERThe top 'k' similar results to return.false
similarityThresholdSimilarity ThresholdNUMBERSimilarity threshold score to filter the search response by. Only documents with similarity score equal or greater than the threshold will be returned. A threshold value of 0 means any similarity is accepted. A threshold value of 1 means an exact match is required.false

Example JSON Structure

{
  "label" : "Search Documents",
  "name" : "search",
  "parameters" : {
    "query" : "",
    "metadata" : [ { } ],
    "topK" : 1,
    "similarityThreshold" : 0.0
  },
  "type" : "mongodbAtlas/v1/search"
}

Output

The output for this action is dynamic and may vary depending on the input parameters. To determine the exact structure of the output, you need to execute the action.

Update Documents

Name: update

Updates documents in the vector store by deleting existing ones matching the metadata filter and loading new ones using LLM embeddings.

Properties

NameLabelTypeDescriptionRequired
metadataMetadataARRAY
Items [{}]
List of metadata key-value pairs to filter by.false

Example JSON Structure

{
  "label" : "Update Documents",
  "name" : "update",
  "parameters" : {
    "metadata" : [ { } ]
  },
  "type" : "mongodbAtlas/v1/update"
}

Output

This action does not produce any output.

How is this guide?

Last updated on

On this page