AutomationFlowsAI & RAG › Dynamic Mongodb Knowledge Base Chatbot with Openai Gpt

Dynamic Mongodb Knowledge Base Chatbot with Openai Gpt

ByGegenfeld @gegenfeld on n8n.io

This workflow creates an intelligent chatbot that uses your MongoDB database as a knowledge base. The AI agent can automatically query your MongoDB collections to provide accurate, contextual responses based on your stored documents and data.

Chat trigger trigger★★★☆☆ complexityAI-powered9 nodesOpenAI ChatChat TriggerAgentMemory Buffer WindowMongo Db Tool
AI & RAG Trigger: Chat trigger Nodes: 9 Complexity: ★★★☆☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #6622 — we link there as the canonical source.

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "id": "76870e68-37c2-41f9-a07b-4f895cd49332",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        448
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a2012852-fe36-4aef-acf9-abe0ff59cab1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        448
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "9bac9112-c22f-42b3-b24b-df2eaaa2a452",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        448
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e91ab3aa-43e7-4799-a00b-877dc8e9d17d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        -192
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "91c92861-211c-492e-883e-f43f4d9a2d3c",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -400,
        288
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "c614dd51-269d-4349-9728-b19fb78b5f46",
      "name": "Start Chat Conversation",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -448,
        64
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "40661eb9-8802-4fd9-bd7e-0b07871c43e4",
      "name": "Smart AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -192,
        64
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "5a88768f-3249-4f8c-924b-c4d44d36012d",
      "name": "Remember Chat History",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -80,
        288
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "a34afd41-ff47-456b-be9e-ae98e8ddeddd",
      "name": "MongoDB Database Lookup",
      "type": "n8n-nodes-base.mongoDbTool",
      "position": [
        240,
        288
      ],
      "parameters": {},
      "typeVersion": 1.2
    }
  ],
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Smart AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Remember Chat History": {
      "ai_memory": [
        [
          {
            "node": "Smart AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB Database Lookup": {
      "ai_tool": [
        [
          {
            "node": "Smart AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Start Chat Conversation": {
      "main": [
        [
          {
            "node": "Smart AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow creates an intelligent chatbot that uses your MongoDB database as a knowledge base. The AI agent can automatically query your MongoDB collections to provide accurate, contextual responses based on your stored documents and data.

Source: https://n8n.io/workflows/6622/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

MongoDB Agent. Uses lmChatOpenAi, mongoDbTool, memoryBufferWindow, chatTrigger. Chat trigger; 8 nodes.

OpenAI Chat, Mongo Db Tool, Memory Buffer Window +3
AI & RAG

MongoDB Agent. Uses lmChatOpenAi, mongoDbTool, memoryBufferWindow, chatTrigger. Chat trigger; 8 nodes.

OpenAI Chat, Mongo Db Tool, Memory Buffer Window +3
AI & RAG

This workflow is designed for: Database administrators and developers working with MongoDB Content managers handling movie databases Organizations looking to implement AI-powered search and recommenda

OpenAI Chat, Mongo Db Tool, Memory Buffer Window +3
AI & RAG

Generate Sql Queries From Schema Only Ai Powered. Uses lmChatOpenAi, memoryBufferWindow, noOp, mySql. Chat trigger; 29 nodes.

OpenAI Chat, Memory Buffer Window, MySQL +3
AI & RAG

Generate SQL queries from schema only - AI-powered. Uses lmChatOpenAi, memoryBufferWindow, noOp, mySql. Chat trigger; 29 nodes.

OpenAI Chat, Memory Buffer Window, MySQL +3