Hi,
Am getting following error with MongoDB node. Any one help me to resolve this.
There was a problem executing the workflow:
"connect ENOBUFS 127.0.0.1:27017 - Local (undefined:undefined)"
Hi,
Am getting following error with MongoDB node. Any one help me to resolve this.
There was a problem executing the workflow:
"connect ENOBUFS 127.0.0.1:27017 - Local (undefined:undefined)"
Hey @mkiran!
Can you please share some more details? From the error message it looks like MongoDB is not able to connect to n8n. If you can share your workflow, it might help to debug
here is the workflow am using. FYI the MYSQL node returns more than 5000+ results
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
140,
130
]
},
{
"parameters": {
"triggerTimes": {
"item": [
{
"hour": 9,
"minute": 30
}
]
}
},
"name": "Cron",
"type": "n8n-nodes-base.cron",
"typeVersion": 1,
"position": [
230,
560
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "=select task_log_id, task_log_task, task_log_name,p.project_short_name, t.task_name, task_log_description, \n user_username, task_log_hours, task_log_date,\n task_log_approved\nfrom dotp_task_log tl\n\tinner join dotp_tasks t on t.task_id = tl.task_log_task\t\n inner join dotp_projects p on p.project_id = t.task_project\n inner join dotp_users u on u.user_id = tl.task_log_creator\nwhere p.project_name='{{$node[\"SplitInBatches-Prj\"].json[\"name\"]}}';"
},
"name": "MySQL",
"type": "n8n-nodes-base.mySql",
"typeVersion": 1,
"position": [
480,
550
],
"credentials": {
"mySql": "MySQL-TimeCard"
}
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"name": "SplitInBatches",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
710,
550
]
},
{
"parameters": {
"collection": "ProjectTasks",
"query": "={\"taskName\":\"{{$node[\"SplitInBatches\"].json[\"task_name\"]}}\", \"projectId\":\"{{$node[\"SplitInBatches-Prj\"].json[\"_id\"]}}\"}"
},
"name": "MDB-Prj-Task-Find",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
960,
580
],
"retryOnFail": true,
"maxTries": 5,
"credentials": {
"mongoDb": "qms-mongo"
}
},
{
"parameters": {
"functionCode": "if(Object.keys(items[0][\"json\"]).length === 0){\n items[0][\"json\"].projectTaskFound = false;\n} else {\n items[0][\"json\"].projectTaskFound = true;\n}\nreturn items;\n"
},
"name": "Prj-Task-Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1140,
580
]
},
{
"parameters": {
"functionCode": "if(Object.keys(items[0][\"json\"]).length === 0){\n items[0][\"json\"].userFound= false;\n} else {\n items[0][\"json\"].userFound= true;\n}\nreturn items;\n"
},
"name": "User-Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1640,
500
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$node[\"Prj-Task-Function\"].json[\"projectTaskFound\"]}}",
"value2": true
}
]
}
},
"name": "IF-PrjTask",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1310,
580
]
},
{
"parameters": {
"collection": "User",
"query": "={\"userName\":\"{{$node[\"SplitInBatches\"].json[\"user_username\"]}}\"}"
},
"name": "MDB-User-Find",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
1500,
500
],
"retryOnFail": true,
"credentials": {
"mongoDb": "qms-mongo"
}
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$node[\"User-Function\"].json[\"userFound\"]}}",
"value2": true
}
]
}
},
"name": "IF-User",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1780,
500
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "taskLogId",
"value": "=TC-{{$node[\"SplitInBatches\"].json[\"task_log_id\"]}}"
},
{
"name": "taskId",
"value": "={{$node[\"MDB-Prj-Task-Find\"].json[\"_id\"]}}"
},
{
"name": "taskName",
"value": "={{$node[\"Prj-Task-Function\"].json[\"taskName\"]}}"
},
{
"name": "projectId",
"value": "={{$node[\"SplitInBatches-Prj\"].json[\"_id\"]}}"
},
{
"name": "userId",
"value": "={{$node[\"MDB-User-Find\"].json[\"_id\"]}}"
},
{
"name": "taskLogName",
"value": "={{$node[\"SplitInBatches\"].json[\"task_log_name\"]}}"
},
{
"name": "description",
"value": "={{$node[\"SplitInBatches\"].json[\"task_log_description\"]}}"
},
{
"name": "taskLogDate",
"value": "=ISODate(\"{{$node[\"SplitInBatches\"].json[\"task_log_date\"]}}\")"
},
{
"name": "userName",
"value": "={{$node[\"IF-User\"].json[\"firstName\"]}}"
}
],
"number": [
{
"name": "hoursSpent",
"value": "={{$node[\"SplitInBatches\"].json[\"task_log_hours\"]}}"
}
],
"boolean": [
{
"name": "isApproved",
"value": "={{$node[\"SplitInBatches\"].json[\"task_log_approved\"]}}"
}
]
},
"options": {}
},
"name": "Set",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
2060,
490
]
},
{
"parameters": {
"operation": "insert",
"collection": "TaskLog",
"fields": "taskLogId, taskId, taskName, projectId, userId, userName, taskLogName, description, hoursSpent, taskDate, isApproved",
"options": {}
},
"name": "MongoDB",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
2200,
650
],
"retryOnFail": true,
"credentials": {
"mongoDb": "qms-mongo"
}
},
{
"parameters": {
"collection": "TaskLog",
"query": "={\"taskLogId\":\"TC-{{$node[\"SplitInBatches\"].json[\"task_log_id\"]}}\"}"
},
"name": "MDB-TaskLog-Find",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
1010,
280
],
"alwaysOutputData": true,
"retryOnFail": true,
"credentials": {
"mongoDb": "qms-mongo"
}
},
{
"parameters": {
"functionCode": "if(Object.keys(items[0][\"json\"]).length === 0){\n items[0][\"json\"].taskLogFound = false;\n} else {\n items[0][\"json\"].taskLogFound = true;\n}\nreturn items;\n"
},
"name": "TaskLog-Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1180,
280
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$node[\"TaskLog-Function\"].json[\"taskLogFound\"]}}",
"value2": true
}
]
}
},
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1330,
280
]
},
{
"parameters": {
"operation": "update",
"collection": "TaskLog",
"updateKey": "taskLogId",
"fields": "isApproved",
"options": {}
},
"name": "MDB-Update",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
1700,
260
],
"credentials": {
"mongoDb": "qms-mongo"
}
},
{
"parameters": {
"values": {
"boolean": [
{
"name": "=isApproved",
"value": "={{$node[\"SplitInBatches\"].json[\"task_log_approved\"]}}"
}
],
"string": [
{
"name": "taskLogId",
"value": "=TC-{{$node[\"SplitInBatches\"].json[\"task_log_id\"]}}"
}
]
},
"options": {}
},
"name": "Set-TaskLogUpdate",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1500,
260
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$node[\"SplitInBatches\"].context[\"noItemsLeft\"]}}"
}
]
}
},
"name": "If-Loop",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
2200,
910
]
},
{
"parameters": {
"functionCode": "var i = $runIndex;\nif (i%750 == 0) {\n\t\n\tconst waitTimeSeconds = 10;\n\treturn new Promise((resolve) => {\n\t setTimeout(() => {\n\t\tresolve(items);\n\t }, waitTimeSeconds * 1000);\n\t});\n} else {\n\treturn items;\n}\n"
},
"name": "Wait",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
810,
270
]
},
{
"parameters": {
"collection": "Project"
},
"name": "MDB-PrjList",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
270,
970
],
"credentials": {
"mongoDb": "qms-mongo"
}
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"name": "SplitInBatches-Prj",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
510,
970
]
},
{
"parameters": {
"functionCode": "const waitTimeSeconds = 10;\n\treturn new Promise((resolve) => {\n\t setTimeout(() => {\n\t\tresolve(items);\n\t }, waitTimeSeconds * 1000);\n\t});\n"
},
"name": "Wait1",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
500,
780
]
}
],
"connections": {
"Cron": {
"main": [
[
{
"node": "MDB-PrjList",
"type": "main",
"index": 0
}
]
]
},
"MySQL": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"SplitInBatches": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"MDB-Prj-Task-Find": {
"main": [
[
{
"node": "Prj-Task-Function",
"type": "main",
"index": 0
}
]
]
},
"Prj-Task-Function": {
"main": [
[
{
"node": "IF-PrjTask",
"type": "main",
"index": 0
}
]
]
},
"User-Function": {
"main": [
[
{
"node": "IF-User",
"type": "main",
"index": 0
}
]
]
},
"IF-PrjTask": {
"main": [
[
{
"node": "MDB-User-Find",
"type": "main",
"index": 0
}
],
[
{
"node": "If-Loop",
"type": "main",
"index": 0
}
]
]
},
"MDB-User-Find": {
"main": [
[
{
"node": "User-Function",
"type": "main",
"index": 0
}
]
]
},
"IF-User": {
"main": [
[
{
"node": "Set",
"type": "main",
"index": 0
}
],
[
{
"node": "If-Loop",
"type": "main",
"index": 0
}
]
]
},
"Set": {
"main": [
[
{
"node": "MongoDB",
"type": "main",
"index": 0
}
]
]
},
"MongoDB": {
"main": [
[
{
"node": "If-Loop",
"type": "main",
"index": 0
}
]
]
},
"MDB-TaskLog-Find": {
"main": [
[
{
"node": "TaskLog-Function",
"type": "main",
"index": 0
}
]
]
},
"TaskLog-Function": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "Set-TaskLogUpdate",
"type": "main",
"index": 0
}
],
[
{
"node": "MDB-Prj-Task-Find",
"type": "main",
"index": 0
}
]
]
},
"MDB-Update": {
"main": [
[
{
"node": "If-Loop",
"type": "main",
"index": 0
}
]
]
},
"Set-TaskLogUpdate": {
"main": [
[
{
"node": "MDB-Update",
"type": "main",
"index": 0
}
]
]
},
"If-Loop": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
],
[
{
"node": "SplitInBatches-Prj",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "MDB-TaskLog-Find",
"type": "main",
"index": 0
}
]
]
},
"MDB-PrjList": {
"main": [
[
{
"node": "SplitInBatches-Prj",
"type": "main",
"index": 0
}
]
]
},
"SplitInBatches-Prj": {
"main": [
[
{
"node": "Wait1",
"type": "main",
"index": 0
}
]
]
},
"Wait1": {
"main": [
[
{
"node": "MySQL",
"type": "main",
"index": 0
}
]
]
}
}
}
no its not resolved.
Can I know what credentials you’re using for the node? Are you using the Values
Configuration Type or the Connection String
?
I came across this StackOverflow question, I think this might help.
am using configuration type
Gotcha. Can you check your credentials and make sure the IP is whitelisted? You can find more information in the link I shared earlier. This more of a MongoDB issue and not n8n