Nodes/ComfyUI-ZMongo/06 Delete Document
ComfyUI Node

06 Delete Document

Delete a document from ZMongo (with a safety switch)

By CentralFloridaAttorney·Created 5 months ago·Updated 2 months ago· 1
06 Delete Document
  • session
  • document_id_link
  • json
  • document_id
  • success
  • refresh
  • document_ids
  • selectable_items
  • indexed_items
  • item_count
document_id
confirm_deletefalse
document_prefix/documents
refresh_token

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 - the ZMONGO_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's document_id output, or document_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.

CategoryZMongo/03 Documents

Inputs (6)

NameTypeDefaultDescription
sessionZMONGO_API_SESSION
document_idSTRING
confirm_deleteBOOLEANfalse
document_prefixSTRING/documents
document_id_linkopt*
refresh_tokenoptSTRING

Outputs (8)

NameTypeDescription
jsonSTRING
document_idSTRING
successBOOLEAN
refreshSTRING
document_ids*
selectable_items*
indexed_itemsSTRING
item_countINT