03 Delete Doc
Removing a record without nuking the whole collection
- session
- json
- refresh
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_jsonof{}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 ofabc123. The node cleans that up for you, which is thoughtful, but it's a sign that these inputs expect raw scalar values. Wiredocument_idandconfirm_document_idfrom 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.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| collection_name | STRING | — | |
| query_json | STRING | {} | — |
| document_id | STRING | — | |
| confirm_document_id | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| json | STRING | — |
| refresh | STRING | — |