All nodes/Data/Database

DB Delete

Deletes documents by filter. multi=true deletes all matches.

DB Delete
FilterResult

Type in the graph: db_delete

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

Entry
DB Delete
Exit
  • Execute + Data
Press “Copy nodes”, open the editor and hit Ctrl+V on the canvas.

Runs as pasted

When to use it

Delete removes documents from a collection for good: there is no restore, no bin, no edit history. In day-to-day workflows a soft delete is usually the better fit — db_update with {"$set": {"deleted": true}} plus a filter on that field in every read: the data stays available for reports and you can still change your mind. Real deletion is for housekeeping: clearing temporary records, honouring a user’s erasure request, resetting a collection before a run.

How it works

The Filter port carries both the trigger and the filter. An object arriving over the edge is the filter used; when nothing arrives, the configured one is. A value of the wrong shape fails the node — a rule that exists for this node above all, because a silent fall back to the configured filter would turn a typo into “delete everything”.

The Delete many flag decides how much goes: with it off exactly one of the matching documents is removed, and which one is undefined. The output holds deleted, the number of documents removed.

Common mistakes

  • Assuming there was something to delete. deleted: 0 is a success, not an error. When your scenario requires a match, check the counter with if.
  • Letting the filter arrive by itself. The edge into the port carries the previous node’s value, and an object of the right shape but the wrong content deletes the wrong documents. Supply the filter explicitly — a template emitting a JSON object, or code_javascript — or split the ports and wire only execution into the node, keeping the configured filter.
  • Deleting by a non-unique field without the flag. Without Delete many one document out of ten matches goes, and the run reports success.
  • Templates in the filter field. {{ … }} is not expanded in a JSON editor and is compared as an ordinary string, so the filter simply matches nothing.
  • Forgetting the storage counters. The freed bytes return to the workspace quota immediately, but the documents themselves do not come back — back up the selection first with db_find and a write to a file.

Inputs

PortWirePayloadNotes
FilterinputExecute + 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

PortWirePayloadNotes
ResultoutputExecute + Dataexecute_dataobject

Configuration

FieldTypeDefaultDescription
Collectioncollection_idstring""

Collection ID

Filterfilterobject

Delete manymultibooleanfalse

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.