If you've ever used MongoDB with n8n, you've probably hit this limitation.
The MongoDB node in n8n doesn’t actually support real MongoDB update operations.
Yeah… that surprised me too.
😤 The Problem
The existing update functionality is extremely limited:
- Only allows updating a single field
- Uses
updateKey+ value - Internally tied to
updateOne
That means no support for native MongoDB update operators like:
-
$set(multiple fields) $pull$push$rename$inc
🤯 Real-world limitation
Let’s say you want to remove a value from an array:
{
"$pull": {
"tags": "deprecated"
}
}
👉 Not possible in the current node.
Or update multiple fields:
{
"$set": {
"status": "active",
"updatedAt": "2026-01-01"
}
}
🧠 The Workarounds (that shouldn’t exist)
Because of this, developers are forced to:
- Use aggregation pipelines 😬
- Add Code nodes 🤯
- Chain multiple operations 😵 This defeats the purpose of using a low-code tool like n8n.
💡 The Fix
I created a PR that enables JSON-based update operations in the MongoDB node.
✅ What’s new?
You can now define:
- A JSON filter
- A JSON update object 👉 Just like native MongoDB.
🔥 Before vs After
❌ Before
- One field update only
- No operators
- Limited flexibility
✅ After (JSON Mode)
{
"filter": {
"userId": "123"
},
"update": {
"$set": {
"status": "active"
},
"$inc": {
"loginCount": 1
}
}
}
👉 Clean
👉 Flexible
👉 Powerful
🛠️ What this unlocks
This change enables:
- Updating multiple fields in one operation.
- Using advanced operators like $pull, $push, $rename.
- Writing cleaner workflows.
- Removing unnecessary Code nodes.
- Aligning with native MongoDB behavior.
⚙️ How it works
A new mode is introduced:
- Simple Mode (existing)
- Uses updateKey
- No changes
- JSON Mode (new) Accepts raw JSON:
- Filter
- Update object 👉 Fully opt-in 👉 No breaking changes
🧪 Stability
✅ Backward compatible
✅ Input validation (invalid / empty JSON)
✅ Unit tests added
✅ All existing tests passing
🎯 Why this matters
n8n is powerful because it bridges the gap between code and no-code.
But limitations like this push developers back into writing code — unnecessarily.
This change:
✔ Reduces friction
✔ Improves flexibility
✔ Matches real MongoDB capabilities
✔ Saves time for developers
🚀 PR Link
👉 https://github.com/n8n-io/n8n/pull/27583
Would love feedback from the community and maintainers!
💬 Final thought
Sometimes the most impactful improvements aren’t flashy…
They’re the ones that remove everyday friction.
This is one of them.
SOCIAL SHARE CARD GENERATOR