For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

Integrate MongoDB with n8n for AI Workflows

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 use the MongoDB nodes in n8n, complete the following steps:

1

To install n8n, see the n8n documentation or run the following command by using npm:

npx n8n
2

All MongoDB n8n nodes require MongoDB credentials. To learn how to add your credentials, see MongoDB Credentials in the n8n documentation.

3

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.

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. To learn more, see db.collection.aggregate().

Find Documents

Query and retrieve documents from your MongoDB collections with flexible filtering options. To learn more, see db.collection.find().

Insert Documents

Add new documents to your MongoDB collections. To learn more, see db.collection.insertMany().

Update Documents

Modify existing documents in your collections. To learn more, see db.collection.updateOne().

Delete Documents

Remove documents from your collections. To learn more, see db.collection.deleteMany().

Find and Replace Documents

Search for documents and replace them with new content. To learn more, see db.collection.findOneAndReplace().

Find and Update Documents

Search for documents and update specific fields. To learn more, see db.collection.findOneAndUpdate().

Search Index Operations

Create Search Indexes

Create new search and vector search indexes on your collections. To learn more, see db.collection.createSearchIndex().

List Search Indexes

Retrieve information about existing search indexes. To learn more, see $listSearchIndexes.

Update Search Indexes

Modify existing search index configurations. To learn more, see db.collection.updateSearchIndex().

Drop Search Indexes

Remove search indexes that are no longer needed. To learn more, see db.collection.dropSearchIndex().

Tip

To learn more, see n8n MongoDB node documentation

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.

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.

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.

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: