All nodes/Data/Database
DB Update
Updates documents matching the filter with a MongoDB-style update expression ($set, $inc, $push, ...). Supports upsert and multi.
Type in the graph: db_update
Exec
An error branch can be enabled (expose_error_output) to handle failures on their own path.
Ports can be split into separate execution and data handles.
Try it
Minimal working workflow
- Execute + Data
Runs as pasted
When to use it
Update changes existing documents: move a ticket to another status, bump a counter, append an item to an array. With Upsert on it becomes “create or update” — the only way to write a document by key so that a repeated run leaves no duplicate (db_insert has no such check). The Update many flag switches the node from one document to every match.
How it works
Two expressions are needed: Filter picks the documents, Update says what to do with them
($set, $inc, $push, $unset, $addToSet and other operators). The Input port accepts an
envelope {"filter": …, "update": …}, in which case both halves arrive over the edge; any other object
is treated as the filter and the update expression stays as configured.
The output has three fields: matched (how many documents the filter picked), modified (how many
actually changed) and upserted_id (the id of the document created when an upsert fired).
Common mistakes
- An expression with no operator.
{"status": "paid"}without$setis not a field edit but a whole-document replacement: the other fields disappear and only_idsurvives. Write{"$set": {"status": "paid"}}. - Judging success by
modified. Zero there does not only mean “nothing matched”: a document that already holds the value is not rewritten, and an upsert also leaves the counter at zero — the new document shows up inupserted_id. Read all three fields. - Forgetting to switch on “Update many”. With the flag off exactly one of the matching documents changes, and which one is undefined.
- Expecting upsert to carry the whole filter into the new document. Only plain top-level equalities
are seeded; conditions such as
{"$gt": …}and dotted paths are not — set those fields explicitly in$set. - Templates in the fields. Filter and Update are JSON editors;
{{ … }}is not expanded there. Build the dynamic part with code_javascript or a template and feed it to the port. $incon a non-numeric field. If the field holds a string the node fails; coerce the type when you write it.
Inputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Inputinput | Execute + Dataexecute_data | — | Run trigger and dynamic payload (overrides static config). The payload must be an object — a value of any other shape fails the node instead of being ignored. |
Outputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Resultoutput | Execute + Dataexecute_data | object |
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
Collectioncollection_id | string | "" | Collection ID |
Filterfilter | object | — | |
Update manymulti | boolean | false | |
Updateupdate | object | — | MongoDB-style update expression ($set, $inc, $push, ...). |
Upsertupsert | boolean | false |
Shared fields
Every node has these three — the platform adds them, not the node author.
expose_error_output— When enabled, show an execution output to connect nodes that run if this step fails.split_ports_in— Show separate execution and data input handles instead of one combined port.split_ports_out— Show separate execution and data output handles instead of one combined port.