06 Save Document Value
Write to any field in a document, dot-path included
- session
- document_id_link
- field_path_link
- json
- document_id
- success
- refresh
- document_ids
- selectable_items
- indexed_items
- item_count
Save Text writes to one hardcoded field; this node writes to any field you name. "06 Save Document Value" takes a field_path in dot notation - metadata.note, prompt.positive, whatever - and writes a value there, creating intermediate dicts along the way if they don't exist. If you're building a parameter library or logging structured state from your workflows, this is the node that makes it possible without writing a single line of Python.
How it works
It POSTs to /api/save-value/{document_id} with {field_path, value, parse_json, normalize_for_storage}. The two toggles matter:
parse_json(defaulttrue) - if your value string is valid JSON, it's parsed and stored as a real object/array/number instead of a string. Turn it off if you genuinely want the literal text{"a": 1}stored as a string.normalize_for_storage(defaultfalse) - asks the backend to normalize/normalize the stored representation. Leave it off until you know you need it; it's for the hosted backend's conventions.
value is a multiline string input, which is why parse_json exists - everything comes in as text and you decide how it's interpreted. document_id (or the typed document_id_link) says which document, field_path (or field_path_link) says where.
Outputs: json, document_id, success (did the write commit), refresh, and the document_ids tail. Notably, this node does not raise on failure - a failed write shows up in json with success: false but doesn't kill your graph, because it's meant to be used in demo/selector workflows where you might point at a bad field.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
Restart, or install via ComfyUI Manager ("ComfyUI-ZMongo").
Where people get burned
The immutable-fields guard is the big one. ZMongo refuses to let you write to identity/ownership fields - _id in particular. Try to save to _id and you'll get a clean, visible failure payload telling you to pick a writable path. That's a feature: MongoDB would reject the write anyway, and this way you find out before anything breaks.
Second, field_path is a dot path, not a slash path and not a JSON path - metadata.note, not metadata/note. And unless parse_json is on, everything lands as a string; a numeric-looking value that comes back as a string from "06 Get Document Value" is usually you forgetting that this default was on or off for the wrong reason.
Pair it with "06 Document Field Paths" to learn the paths before you write to them. That read-then-write loop - Field Paths → Save Value → Get Value to verify - is the core rhythm of using ZMongo as a state store, and it's surprisingly pleasant once it clicks.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| document_id | STRING | — | |
| field_path | STRING | metadata.note | — |
| value | STRING | — | |
| parse_json | BOOLEAN | true | — |
| normalize_for_storage | BOOLEAN | false | — |
| document_prefix | STRING | /documents | — |
| document_id_linkopt | * | — | |
| field_path_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 | — |