You can integrate MongoDB with n8n to build automations and agentic workflows using their no-code visual interface. This page provides an overview of the integration and describes the different types of nodes that you can use in your workflows.
Get Started with n8n
To use the MongoDB nodes in n8n, complete the following steps:
Install n8n.
To install n8n, see the n8n documentation or run the following command by using npm:
npx n8nConfigure your MongoDB credentials in n8n.
All MongoDB n8n nodes require MongoDB credentials. To learn how to add your credentials, see MongoDB Credentials in the n8n documentation.
Create a vector search index.
If you plan to use the MongoDB Atlas Vector Store Node, create a MongoDB Vector Search index on your collection. To learn how to create the index by using the MongoDB node in n8n, see Create the Vector Search Index in n8n.
To learn how to build a basic AI agent using n8n and MongoDB, see Build an AI Agent with MongoDB and n8n.
MongoDB Node
The MongoDB node allows you to automate work in MongoDB and integrate MongoDB with other nodes in your n8n workflows.
MongoDB Node Usage
Use the MongoDB node in any of your custom n8n workflows.
MongoDB Node Operations
The MongoDB node supports the following operations:
Category | Operation | Description |
|---|---|---|
Document Operations | Aggregate Documents | Perform aggregation operations to process and transform data using MongoDB aggregation pipelines. To learn more, see |
Find Documents | Query and retrieve documents from your MongoDB collections with flexible filtering options. To learn more, see | |
Insert Documents | Add new documents to your MongoDB collections. To learn more, see | |
Update Documents | Modify existing documents in your collections. To learn more, see | |
Delete Documents | Remove documents from your collections. To learn more, see | |
Find and Replace Documents | Search for documents and replace them with new content. To learn more, see | |
Find and Update Documents | Search for documents and update specific fields. To learn more, see | |
Search Index Operations | Create Search Indexes | Create new search and vector search indexes on your collections. To learn more, see |
List Search Indexes | Retrieve information about existing search indexes. To learn more, see | |
Update Search Indexes | Modify existing search index configurations. To learn more, see | |
Drop Search Indexes | Remove search indexes that are no longer needed. To learn more, see |
Tip
To learn more, see n8n MongoDB node documentation
MongoDB Atlas Vector Store Node
The MongoDB Atlas Vector Store node enables you to use MongoDB Vector Search in your agentic workflows.
To use this node, you must have a MongoDB Vector Search index on your collection. To learn how to create the index in n8n, see Create the Vector Search Index in n8n.
Vector Store Node Usage
Use the MongoDB Vector Store node in the following workflow patterns:
Connect directly to an AI agent as a tool to perform agentic RAG.
AI Agent (tools connector) → MongoDB Vector StoreFor a tutorial, see Build an AI Agent with MongoDB and n8n.
To learn more about AI agents in n8n, see AI agent node.
Use the MongoDB Atlas Vector Store as a regular node to insert or retrieve documents in your custom workflows:
Trigger → MongoDB Vector Store (Insert/Get) → Next NodeTo learn more, see Nodes.
Use the node as a retriever in a question-answering chain:
Question and Answer Chain → Vector Store Retriever → MongoDB Vector StoreTo learn more about Q&A in n8n, see Question and Answer Chain node.
Use the node as a question-answering tool for an AI agent:
AI Agent → Vector Store Question Answer Tool → MongoDB Vector StoreTo learn more about the question-answering tool in n8n, see Vector Store Question Answer Tool node.
Vector Store Operation Modes
The MongoDB Vector Store node supports the following operation modes. The retrieve document mode is only available in certain workflow patterns.
Operation Mode | Description |
|---|---|
Get Many | Retrieve multiple documents using similarity search based on a prompt. Returns documents with similarity scores. To learn more, see Get Many parameters. |
Insert Documents | Add new documents with vector embeddings to your collection. To learn more, see Insert Documents parameters. |
Retrieve Documents (As Vector Store for Chain/Tool) | Only available when you use the node as a retriever or a tool. Must be connected to a retriever node or root node. To learn more, see Retrieve Documents (As Vector Store for Chain/Tool) parameters. |
Retrieve Documents (As Tool for AI Agent) | Only available when you use the node as a tool for an AI agent. The agent uses this vector store when the name and description are relevant to the prompt. To learn more, see Retrieve Documents (As Tool for AI Agent) parameters. |
Vector Store Node Parameters
Tip
To learn more, see n8n MongoDB Vector Store node documentation
MongoDB Chat Memory Node
The MongoDB Chat Memory node allows you to use MongoDB as a memory store for storing chat history in your AI workflows. This enables persistent conversation context across workflow executions.
Chat Memory Node Usage
You must use the MongoDB Chat Memory node as a sub-node by adding it to the Memory section of an AI agent node. For a tutorial, see Build an AI Agent with MongoDB and n8n.
Note
If you add multiple MongoDB Chat Memory nodes to your workflow, all nodes access the same memory instance by default. For separate memory instances, use different session IDs in each memory node.
Chat Memory Node Parameters
Tip
To learn more, see n8n MongoDB Chat Memory node documentation
Additional n8n Resources
To learn more about n8n, use the following resources: