Templates / Create a secure MongoDB data retrieval API with input validation and HTTP responses

Create a secure MongoDB data retrieval API with input validation and HTTP responses

Ready for 3.0

by Samuel Heredia ✓ · 466 views · created 2025-08-21 · Engineering, Multimodal AI

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This workflow has 7 nodes and runs when an HTTP GET request hits its webhook URL. Along the way it connects MongoDB.

How it runs

Trigger: When an HTTP GET request hits its webhook URL.

  1. Validate Pattern (Code): runs custom JavaScript code
  2. If: checks a condition and branches into true / false
  3. MongoDB: uses MongoDB
  4. Respond code (Respond to Webhook): sends the response back to the webhook caller
  5. IDS format (Code): runs custom JavaScript code
  6. Respond to Webhook: sends the response back to the webhook caller

Services it uses

MongoDB

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (5)

From the author

Data Extraction from MongoDB Overview This workflow exposes a public HTTP GET endpoint to read all documents from a MongoDB collection, with: - Strict validation of the collection name - Error handling with proper 4xx codes - Response formatting (e.g., id →…

Excerpt from Samuel Heredia's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.