MongoDB Vector Store
This component acts as a bridge between your automation workflow and a MongoDB Atlas database. Its primary purpose is to enable Semantic Search (also known as vector search), allowing your applications to find documents that are conceptually similar to a query, rather than just matching exact keywords.
It is designed for use in RAG (Retrieval-Augmented Generation) workflows, where you need to retrieve relevant information from a large database to help an AI generate accurate answers. Think of this component as the “library” in your data system: it holds your documents and makes them easily searchable by meaning.
How it Works
Internally, this component connects to your MongoDB Atlas instance. It manages the storage of “vector embeddings” (numerical representations of text) and the associated metadata (like the original text content).
When you use this component, it performs two main tasks:
- Storage: It saves data into a specific collection within your database, preparing it for fast retrieval.
- Retrieval: When a search is requested, it uses MongoDB’s native vector search capabilities to find the most relevant documents based on the similarity between the stored vectors and the search query.
This integration allows your Nappai workflows to leverage MongoDB’s scalable infrastructure for managing large amounts of data efficiently.
Connection & Credentials
This component requires configuring a credential in the Nappai panel before interacting with the external service:
- Go to the Credentials section in your Nappai panel.
- Create a new credential of the type MongoDB Connection and fill in the required fields (Connection String, User, Password, Cluster, etc.).
- In your workflow, select the saved credential in the Credential input field of this node.
Inputs
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
- Database Name: The name of the specific database inside your MongoDB Atlas instance where the vectors will be stored.
- Collection Name: The name of the collection (the logical container) within the database where your vector data will be saved.
- Vector Index Name: The name of the vector search index created in your MongoDB collection. This index defines how the search algorithm (e.g., cosine similarity) operates. If not specified, the component may use a default name.
- Embedding Model Reference: A reference to the component or model that converts your raw text into vectors (embeddings). This ensures the data is processed correctly before storage.
Outputs
This component produces a Vector Store Object (Reference).
- Vector Store Object: This is not a piece of data itself, but a “handle” or reference. You will connect this output to other components in your workflow, such as a Search node or a Retrieve node. This link allows those downstream components to access the data stored in your MongoDB Atlas instance.
- Operation Success: A boolean value indicating whether the connection or storage operation was successful.
Output Data Example (JSON)json
{ “vector_store_reference”: { “type”: “Object/Reference”, “description”: “A link to the configured MongoDB Atlas Vector Store”, “connects_to”: [“Search Node”, “Retriever Node”] }, “success”: true, “status_message”: “Connection established successfully” }
Connectivity
In a typical automation workflow, this component is used in the following way:
- From: It is usually the starting point for any data retrieval task involving MongoDB Atlas. It does not typically receive inputs from other components other than configuration data.
- To: The output (Vector Store Object) is primarily connected to Search or Retrieval components.
- Why: These downstream components need a reference to the database to perform the actual search. By connecting the Store component to a Search component, you enable the workflow to look up relevant information based on semantic meaning.
Usage Example
Imagine you are building a customer support chatbot.
- Setup: You add the MongoDB Vector Store component to your workflow.
- Configuration: You provide your MongoDB connection details (via the Credential field), specify the database name (
support_db), and the collection name (ticket_data). - Connection: You connect the output of this component to a Vector Search component.
- Result: When a user asks a question, the search component uses the reference from this store to find the most relevant support ticket answers in your MongoDB database, allowing the AI to generate a helpful response.
Tips and Best Practices
- Index Management: Ensure that the Vector Index Name you specify matches an index actually created in your MongoDB Atlas UI. If the index does not exist, search operations will fail.
- Embedding Consistency: Make sure the Embedding Model you reference generates vectors that match the dimensions expected by your MongoDB vector index. Mismatched dimensions will cause search errors.
- Credential Security: Always use the Nappai Credential system to store your connection strings. Never hardcode passwords in your workflow inputs.
Security Considerations
- Credential Handling: This component relies on the Nappai Credential system. Ensure your MongoDB Connection Credential is stored securely and only shared with authorized users.
- Data Access: The component interacts directly with your MongoDB Atlas instance. Ensure your MongoDB user credentials have the necessary permissions for vector search operations (e.g.,
AtlasVectorSearchaccess) but follow the principle of least privilege. - Data Privacy: Be mindful of the data stored in the database. Since vector search retrieves similar documents, ensure that sensitive information is handled according to your organization’s data privacy policies.