Migrate large Hugging Face datasets to MongoDB with a looping subworkflow
Ready for 3.0What this workflow does
This workflow has 15 nodes and runs manually, when you click “Execute workflow” (plus 1 other trigger). Along the way it connects MongoDB. It also calls datasets-server.huggingface.co over HTTP.
How it runs
Trigger: Manually, when you click “Execute workflow” (plus 1 other trigger).
- Config_Start (Edit Fields (Set)): sets 6 fields: offset, length, dataset…
- HF_FetchRows (HTTP Request): calls datasets-server.huggingface.co
- InsertBatch (Execute Sub-workflow): calls another n8n workflow
- Extract_Rows (Edit Fields (Set)): sets 1 field: rows
- ContinueLoop? (If): checks a condition and branches into true / false
- HasRows? (If): checks a condition and branches into true / false
- Row_Splitter (Split Out): splits a list into separate items
- NoRows_Offset (Edit Fields (Set)): sets 1 field: rows_count
- Transform_RemoveId_AddMeta (Code): runs custom JavaScript code
- Mongo_InsertOrUpsert (MongoDB): insert
…plus 2 more steps. See the full node list below.
Services it uses
HTTP calls to: datasets-server.huggingface.co
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.
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (11)
- Aggregate
n8n-nodes-base.aggregate - Edit Fields (Set)
n8n-nodes-base.set - Execute Workflow Trigger
n8n-nodes-base.executeWorkflowTrigger - HTTP Request
n8n-nodes-base.httpRequest - If
n8n-nodes-base.if - Split Out
n8n-nodes-base.splitOut - Code
n8n-nodes-base.code - MongoDB
n8n-nodes-base.mongoDb - Manual Trigger
n8n-nodes-base.manualTrigger - No Operation, do nothing
n8n-nodes-base.noOp - Execute Sub-workflow
n8n-nodes-base.executeWorkflow
From the author
This n8n template provides a production-ready, memory-safe pipeline for ingesting large Hugging Face datasets into MongoDB using batch pagination. It is designed as a reusable data ingestion layer for RAG systems, recommendation engines, analytics pipelines,…