AI-Powered MongoDB Movie Agent
detail.loadingPreview
Leverage the power of AI to interact with your MongoDB data. This workflow intelligently queries your movie collection using natural language and allows you to save favorite movies back into your database.
About This Workflow
This n8n workflow orchestrates an AI agent capable of understanding chat messages to retrieve and manipulate data within a MongoDB database. It utilizes OpenAI's chat models to interpret user requests and dynamically generate MongoDB aggregation pipelines to fetch relevant information from a 'movies' collection. The agent can also leverage a separate workflow to insert user-selected favorite movies back into MongoDB, demonstrating a seamless blend of AI-driven interaction and database management. This solution is ideal for applications requiring intelligent data access and user-driven data enrichment within MongoDB.
Key Features
- Natural Language Querying: Interact with your MongoDB data using plain English.
- Dynamic MongoDB Aggregation: AI generates complex aggregation pipelines for precise data retrieval.
- Favorite Movie Storage: Seamlessly save user-selected movies back into your MongoDB database.
- AI Chat Integration: Built to receive and process chat messages for interactive workflows.
- Modular Design: Extensible with other n8n nodes and custom workflows.
How To Use
- Set up Credentials: Ensure you have configured your OpenAI API key and MongoDB connection credentials within n8n.
- Configure 'When chat message received': This node acts as your entry point. Set up its webhook to receive incoming chat messages.
- Define AI Agent Prompt: Customize the 'AI Agent - Movie Recommendation' node's 'text' parameter to guide the AI on how to interpret user input and when to use specific tools.
- Configure 'OpenAI Chat Model': Link your OpenAI credentials to this node.
- Configure 'MongoDBAggregate': Ensure the 'collection' is set to 'movies' and the 'query' parameter is correctly set up to use the
$fromAIfunction to dynamically generate the aggregation pipeline based on AI input. - Configure 'insertFavorite' Tool: This node represents a separate workflow (
insertMongoDB) to handle adding favorite movies. Ensure its 'workflowId' points to the correct workflow. - Connect Nodes: Establish the connections as shown in the workflow diagram: 'When chat message received' to 'AI Agent - Movie Recommendation', and the respective tool nodes ('MongoDBAggregate', 'insertFavorite') to the AI Agent.
Apps Used
Workflow JSON
{
"id": "db4cf9ca-dff0-4470-8d62-907df0d09699",
"name": "AI-Powered MongoDB Movie Agent",
"nodes": 16,
"category": "Marketing",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: db4cf9ca-dff0...
About the Author
AI_Workflow_Bot
LLM Specialist
Building complex chains with OpenAI, Claude, and LangChain.
Statistics
Related Workflows
Discover more workflows you might like
AI-Powered On-Page SEO Audit & Report Automation
Instantly generate comprehensive on-page SEO technical and content audits for any website URL. This AI-powered workflow automates the entire process, from scraping the page to delivering a detailed report directly to your inbox, empowering you to optimize for better search rankings and user engagement.
Automate LinkedIn Content Promotion for Your Ghost Blog with AI
Effortlessly promote your latest Ghost blog posts on LinkedIn. This workflow leverages AI to generate engaging, professional LinkedIn messages based on your article content and saves them, along with article metadata, directly to a Google Sheet.
AI-Powered Instagram Comment Automation
This n8n workflow intelligently automates responses to Instagram comments, leveraging advanced AI to engage with your audience. It filters out irrelevant content and personalizes replies, saving you time while boosting your social media presence.