08 Save Preset By Node ID
ZMongo Save Preset By Node ID
- session
- preset_json
- preset_name
- saved_count
- storage_backend_used
- document_id
- status
This is the node that makes ComfyUI-ZMongo's 08 Presets idea make sense. Instead of routing a dozen wires for seed, steps, CFG, and sampler across your graph, you point Save Preset By Node ID at any node on your canvas and it snapshots that node's entire state - every widget, combo choice, slider, and input - as one named preset. Run it once, and that KSampler's settings live in a file (or in ZMongo's database) instead of being frozen into the workflow JSON.
The pitch: your parameter values stop being part of the graph. You tune once, save, and reload the same configuration anywhere. If you've hit the wall where every workflow share needs you to hand-enter a sampler config, you can see the appeal immediately.
How it works
The trick is ComfyUI's hidden PROMPT input. When the workflow runs, ComfyUI passes the node the full prompt structure of the graph, so this node can look up target_node_id and read that node's actual widget and input values at execution time. It captures widgets, choices, sliders, and connection coordinates into a structured preset object with a field list.
The interesting part is dynamic connection flattening. If your target node gets a value from an upstream link rather than a widget, the save node traces the connection chain back to its source and saves the resolved literal value - so the preset works even when the live graph is wired through dynamic preset outputs. If it can't resolve something, it records it in unresolved_links on the payload and flags a warning instead of silently dropping it.
save_mode controls how much you grab: widgets_only, inputs_only, or the default widgets_and_inputs. The author's tooltip says the default is "safest when the target node is already connected to dynamic preset outputs."
Inputs and outputs that matter
target_node_id- the ComfyUI node ID number to snapshot. Find it in the node title bar or properties; this is the one beginners get wrong.preset_name- what to call the saved preset.storage_backend-autouses the ZMongo API when a session is connected, otherwise writes a local JSON file. Explicitlocal_file/zmongo_apioverride it.overwrite- defaulttrue; set false and an existing preset with the same name errors instead of replacing.session- optional, but required if you pickzmongo_api.
Outputs: preset_json (the full payload, handy to feed straight into Preset Debug Info), preset_name, saved_count, storage_backend_used, document_id (populated only on the API backend), and status.
Local saves land at ComfyUI-ZMongo/zmongo_presets/<collection_name>/<preset_name>.json.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
Restart ComfyUI (or install "ComfyUI-ZMongo" via ComfyUI Manager). The shipped requirements.txt pulls in a lot - pymongo, langchain, sentence-transformers, transformers - even if you only use presets, so the first install is slow.
Common issues
- "ERROR: node not found" - the
target_node_iddoesn't exist in the workflow. Double-check the number; IDs change if you copy-paste nodes around. - Unresolved link warnings - normal when the target's inputs come from dynamic outputs in
widgets_only/widgets_and_inputsmode. Check theunresolved_linksfield in the JSON and debug it with the Preset Debug Info node. - Preset won't overwrite -
overwriteis off. Flip it, or the node returns an error by design.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| preset_name | STRING | main_sampler | Name used to save this node preset. |
| target_node_id | STRING | 1 | The ComfyUI node id number to inspect and save. |
| collection_name | STRING | workflow_presets | Local preset folder or ZMongo collection name. |
| storage_backend | COMBO | auto | auto uses ZMongo API when session is connected, otherwise local file. |
| overwrite | BOOLEAN | true | Replace an existing preset with the same name. |
| save_mode | COMBO | widgets_and_inputs | widgets_and_inputs is safest when the target node is already connected to dynamic preset outputs. |
| sessionopt | ZMONGO_API_SESSION | Optional API session. Required for zmongo_api storage. |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| preset_json | STRING | — |
| preset_name | STRING | — |
| saved_count | INT | — |
| storage_backend_used | STRING | — |
| document_id | STRING | — |
| status | STRING | — |