Nodes/ComfyUI-ZMongo/03 Delete Doc
ComfyUI Node

03 Delete Doc

Removing a record without nuking the whole collection

By CentralFloridaAttorney·Created 5 months ago·Updated 2 months ago· 1
03 Delete Doc
  • session
  • json
  • refresh
collection_name
query_json{}
document_id
confirm_document_id

03 Delete Doc removes one document from a ZMongo collection - the surgical counterpart to Delete Collection's scorched earth. It's for when your store has accumulated junk records, when a test document needs cleaning up, or when a pipeline prunes stale entries as part of a routine.

You can target a document two ways, and this is where the node gets slightly opinionated.

How it works

Required inputs:

  • session - from the API Key Session node.
  • collection_name - where the document lives.
  • query_json - a Mongo-style query (defaults to {}).
  • document_id - the specific document to delete.
  • confirm_document_id - the safety field.

The logic in the source is: if you provide a document_id, it must match confirm_document_id exactly, or the node refuses with a 400-style error. If you don't provide an id, the node requires a non-empty query_json to know what to delete. Give it neither - empty id and empty {} query - and it flat-out refuses, because that would be a "delete everything" with none of the intent.

Outputs are the familiar json (backend result) and refresh (dirty token) pair.

The traps

  • The confirm field is only checked when you target by id. By-query deletion has no confirmation at all, so query_json of {} on its own is refused, but any non-empty query is taken at face value. A sloppy query deletes everything it matches.
  • ComfyUI input quirks are real here. The source even includes defensive code to strip brackets, parens, trailing commas, and quotes from the id fields - because list outputs like "99 Select Nth Item" can hand you ['abc123'] instead of abc123. The node cleans that up for you, which is thoughtful, but it's a sign that these inputs expect raw scalar values. Wire document_id and confirm_document_id from the same upstream output so they can't diverge.
  • If the source's debug payload is anything to go by, this is the node people trip over most in the pack - the error responses literally include a checklist ("Connect document_id directly from 99 Select Nth Item", "Connect confirm_document_id directly from the same output").

Install

ComfyUI Manager → search ComfyUI-ZMongo → install → restart. Or clone:

cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo

Same pack-wide note: requirements.txt installs far more than the README's short pip line suggests; the first startup after install is slow.

CategoryZMongo/02 Docs

Inputs (5)

NameTypeDefaultDescription
sessionZMONGO_API_SESSION
collection_nameSTRING
query_jsonSTRING{}
document_idSTRING
confirm_document_idSTRING

Outputs (2)

NameTypeDescription
jsonSTRING
refreshSTRING