06 Update Document Metadata
Tag and triage your documents without touching the record body
- session
- document_id_link
- json
- document_id
- success
- refresh
- document_ids
- selectable_items
- indexed_items
- item_count
Once your document store grows past a handful of records, you need a way to organize it without rewriting content. "06 Update Document Metadata" is the tidy version of Save Value: instead of a free-form dot path, it gives you structured, first-class metadata fields - title, description, status, case_id, and tags - plus a metadata_json escape hatch for anything custom. If you're running a document pipeline with an LLM in the loop, this is the node that lets the LLM's output become a filterable, findable record.
How it works
It POSTs /api/metadata/{document_id} with the fields you've filled in. The pattern worth noticing: fields you leave empty are simply not sent - there's no "clear everything" footgun. metadata_json (default {}) is the structured metadata blob that merges in, tags_json (default []) is a JSON array of tags, and case_id, status, title, description are the convenience fields with real names. This is a metadata update - the document body itself is untouched, so you're adding organization, not rewriting content.
Outputs: json (full response), document_id, success, refresh, and the document_ids list tail. The document_id input (or guarded document_id_link) is the only thing that identifies which document; everything else is what you're setting on it.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
Restart ComfyUI, or install "ComfyUI-ZMongo" from ComfyUI Manager.
Where people get burned
The empty-string means "skip" behavior is easy to misread. If you clear the status field expecting to wipe the stored status, nothing happens - the node just omits it from the request. If you genuinely need to remove a metadata value, you're in "06 Save Document Value" territory (write an empty value to the exact dot path), not this node. It's an upsert tool, not an erase tool.
Second, metadata_json and tags_json must be valid JSON. Garbage in either one is parsed to {} / [] (the same lenient parse as the rest of the pack), so you won't crash - you'll just silently save nothing. If you're piping LLM output into these, validate it with a JSON-check node first; LLMs emit trailing commas at the most inconvenient times.
And the case_id / status fields hint at this pack's intended use - it leans into "case-style" document pipelines (the README frames the whole thing as a production ecosystem with legal-ish document handling). You don't have to use those fields, but if you ever find yourself storing a status string in metadata_json, this node's named fields are the tidier home for it.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| document_id | STRING | — | |
| metadata_json | STRING | {} | — |
| case_id | STRING | — | |
| status | STRING | — | |
| title | STRING | — | |
| description | STRING | — | |
| tags_json | STRING | [] | — |
| 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 | — |