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.
Top comments (0)