Nodes/ComfyUI-ZMongo/08 Save Preset By Node ID
ComfyUI Node

08 Save Preset By Node ID

ZMongo Save Preset By Node ID

By CentralFloridaAttorney·Created 5 months ago·Updated 2 months ago· 1
08 Save Preset By Node ID
  • session
  • preset_json
  • preset_name
  • saved_count
  • storage_backend_used
  • document_id
  • status
preset_namemain_sampler
target_node_id1
collection_nameworkflow_presets
storage_backendauto
overwritetrue
save_modewidgets_and_inputs

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 - auto uses the ZMongo API when a session is connected, otherwise writes a local JSON file. Explicit local_file / zmongo_api override it.
  • overwrite - default true; set false and an existing preset with the same name errors instead of replacing.
  • session - optional, but required if you pick zmongo_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_id doesn'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_inputs mode. Check the unresolved_links field in the JSON and debug it with the Preset Debug Info node.
  • Preset won't overwrite - overwrite is off. Flip it, or the node returns an error by design.
CategoryZMongo/08 Presets

Inputs (7)

NameTypeDefaultDescription
preset_nameSTRINGmain_samplerName used to save this node preset.
target_node_idSTRING1The ComfyUI node id number to inspect and save.
collection_nameSTRINGworkflow_presetsLocal preset folder or ZMongo collection name.
storage_backendCOMBOautoauto uses ZMongo API when session is connected, otherwise local file.
overwriteBOOLEANtrueReplace an existing preset with the same name.
save_modeCOMBOwidgets_and_inputswidgets_and_inputs is safest when the target node is already connected to dynamic preset outputs.
sessionoptZMONGO_API_SESSIONOptional API session. Required for zmongo_api storage.

Outputs (6)

NameTypeDescription
preset_jsonSTRING
preset_nameSTRING
saved_countINT
storage_backend_usedSTRING
document_idSTRING
statusSTRING