Docs Menu
Docs Home
/
Atlas
/ /

Integrate MongoDB with n8n

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.

To install n8n, refer to the n8n documentation or run the following command using npm to quickly get started:

npx n8n

To learn how to build a basic AI agent using n8n and MongoDB, see Build an AI Agent with MongoDB and n8n.

Important

All MongoDB n8n nodes require you to configure your MongoDB credentials in n8n. To learn more, see MongoDB Credentials.

The MongoDB node allows you to automate work in MongoDB and integrate MongoDB with other nodes in your n8n workflows.

Use the MongoDB node in any of your custom n8n workflows.

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.

Find Documents

Query and retrieve documents from your MongoDB collections with flexible filtering options.

Insert Documents

Add new documents to your MongoDB collections.

Update Documents

Modify existing documents in your collections.

Delete Documents

Remove documents from your collections.

Find and Replace Documents

Search for documents and replace them with new content.

Find and Update Documents

Search for documents and update specific fields.

Search Index Operations

Create Search Indexes

Create new search and vector search indexes on your collections.

List Search Indexes

Retrieve information about existing search indexes.

Update Search Indexes

Modify existing search index configurations.

Drop Search Indexes

Remove search indexes that are no longer needed.

Tip

The MongoDB Atlas Vector Store node enables you to use MongoDB Vector Search in your agentic workflows.

Note

Before you can start using this node, configure the MongoDB Vector Search Index.

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 Store

For 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 Node

To learn more, see Nodes.

Use the node as a retriever in a question-answering chain:

Question and Answer Chain → Vector Store Retriever → MongoDB Vector Store

To 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 Store

To learn more about the question-answering tool in n8n, see Vector Store Question Answer Tool node.

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.

Insert Documents

Add new documents with vector embeddings to your collection.

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.

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.

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.

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.

To learn more about n8n, use the following resources:

Back

MCP Server

On this page