Some further clarifications on the exact problem that I’m having: I think in the post that I referenced above, the problem seemed to be with batch updates. However, the issue that I am experiencing is with updating individual items (therefore I don’t think the “Split in Batches” node will be able to help me here).
Here is a test workflow that demonstrates the issue that I’m experiencing. It seems that the very first document added to the Mongo collection is able to be updated without issue. However, updates attempted on any subsequent documents fail.
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
250,
100
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "text",
"value": "updated_text"
}
]
},
"options": {}
},
"name": "Set",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
900,
0
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "text",
"value": "updated_text"
}
]
},
"options": {}
},
"name": "Set1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
900,
200
]
},
{
"parameters": {
"collection": "test",
"query": "{ \"name\": \"item1\"}"
},
"name": "Find Item1",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
750,
0
],
"credentials": {
"mongoDb": "Mongo"
}
},
{
"parameters": {
"collection": "test",
"query": "{ \"name\": \"item2\"}"
},
"name": "Find Item2",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
750,
200
],
"credentials": {
"mongoDb": "Mongo"
}
},
{
"parameters": {
"functionCode": "return [{\n json: {\n name: \"item1\",\n text: \"original_text\"\n }\n}, {\n json: {\n name: \"item2\",\n text: \"original_text\"\n }\n}];"
},
"name": "Define items",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
400,
100
]
},
{
"parameters": {
"operation": "insert",
"collection": "test",
"fields": "name, text"
},
"name": "Insert items",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
550,
100
],
"credentials": {
"mongoDb": "Mongo"
}
},
{
"parameters": {
"operation": "update",
"collection": "test",
"fields": "text"
},
"name": "This update works",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
1050,
0
],
"credentials": {
"mongoDb": "Mongo"
}
},
{
"parameters": {
"operation": "update",
"collection": "test",
"fields": "text"
},
"name": "This update doesn't",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
1050,
200
],
"credentials": {
"mongoDb": "Mongo"
}
},
{
"parameters": {
"collection": "test",
"query": "{ \"name\": \"item1\"}"
},
"name": "Find",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
1200,
0
],
"credentials": {
"mongoDb": "Mongo"
}
},
{
"parameters": {
"collection": "test",
"query": "{ \"name\": \"item2\"}"
},
"name": "Find1",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
1200,
200
],
"credentials": {
"mongoDb": "Mongo"
}
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Define items",
"type": "main",
"index": 0
}
]
]
},
"Set": {
"main": [
[
{
"node": "This update works",
"type": "main",
"index": 0
}
]
]
},
"Set1": {
"main": [
[
{
"node": "This update doesn't",
"type": "main",
"index": 0
}
]
]
},
"Find Item1": {
"main": [
[
{
"node": "Set",
"type": "main",
"index": 0
}
]
]
},
"Find Item2": {
"main": [
[
{
"node": "Set1",
"type": "main",
"index": 0
}
]
]
},
"Define items": {
"main": [
[
{
"node": "Insert items",
"type": "main",
"index": 0
}
]
]
},
"Insert items": {
"main": [
[
{
"node": "Find Item1",
"type": "main",
"index": 0
},
{
"node": "Find Item2",
"type": "main",
"index": 0
}
]
]
},
"This update works": {
"main": [
[
{
"node": "Find",
"type": "main",
"index": 0
}
]
]
},
"This update doesn't": {
"main": [
[
{
"node": "Find1",
"type": "main",
"index": 0
}
]
]
}
}
}