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.
This article was originally published by DEV Community and written by Milan K Jain.
Read original article on DEV Community