06 Delete Document
Delete a document from ZMongo (with a safety switch)
- session
- document_id_link
- json
- document_id
- success
- refresh
- document_ids
- selectable_items
- indexed_items
- item_count
Every database needs a delete, and ComfyUI-ZMongo's 06 Delete Document is the one - with a foot-gun guard built in. To actually remove a document you must set confirm_delete: true. Leave it off and the node refuses, returning success: false with the message "Delete not executed. Set confirm_delete=true." That flag existing at all tells you the author has watched someone's workflow nuke a collection by accident.
What it needs
session- theZMONGO_API_SESSION, required. Delete is a write through your backend (or local file store), so no session, no deletion.document_id- the document to remove. This is the one you'll source from a list node, a Create node'sdocument_idoutput, ordocument_id_link.confirm_delete- the safety flag. It's a boolean widget; think of it as the "I really mean it" checkbox.document_prefix- default/documents, the API route base. Leave it alone unless your backend is mounted elsewhere.
There's also an optional document_id_link (* type) - if you wire a ZMONGO_DOCUMENT_ID-typed link into it, the node prefers that value over the plain document_id string when both are present. It's a small convenience for keeping typed connections through your graph.
Outputs
json carries the server's response (read this when something goes wrong), document_id echoes what was targeted, success is your flag, and refresh is the dirty token for forcing downstream re-execution. The document_ids, selectable_items, indexed_items, and item_count tail feed the pack's list-selection pattern, so you can chain delete-after-select workflows.
The trap
The failure mode people actually hit: wiring a workflow where the document id comes from upstream, then running it in a batch or a loop, and discovering a previously-loaded document id is now stale - the delete returns an error, but because the node doesn't crash the graph (it reports via success and json), you can end up with a "successful-looking" run that deleted nothing. Read the json output on deletes, not just success. Also, before you wire confirm_delete to a constant true, remember why the flag exists - a misconfigured batch run can quietly empty a collection you cared about.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| document_id | STRING | — | |
| confirm_delete | BOOLEAN | false | — |
| document_prefix | STRING | /documents | — |
| document_id_linkopt | * | — | |
| refresh_tokenopt | STRING | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| json | STRING | — |
| document_id | STRING | — |
| success | BOOLEAN | — |
| refresh | STRING | — |
| document_ids | * | — |
| selectable_items | * | — |
| indexed_items | STRING | — |
| item_count | INT | — |