Nodes/ComfyUI-ZMongo/06 Get Document Value
ComfyUI Node

06 Get Document Value

Pluck one field out of a document with dot notation

By CentralFloridaAttorney·Created 5 months ago·Updated 2 months ago· 1
06 Get Document Value
  • session
  • document_id_link
  • field_path_link
  • json
  • value
  • exists
  • value_type
  • refresh
  • value_items
  • selectable_items
  • indexed_items
  • item_count
document_id
field_pathtext
fallback
document_prefix/documents
refresh_token

"Get Document" gives you the whole record and "Get Text" gives you the text, but what if you want just the metadata.note field, or the document_text.line_count, or some deeply nested value? That's this node. "06 Get Document Value" reads a single field out of a document using dot-notation paths - the read half of the Save Value pair, and the one you'll use when your workflow only cares about one number or string buried in a record.

How it works

It fetches the document (via /api/get/{document_id}) and then walks the field_path through the structure, split on dots - metadata.note means document["metadata"]["note"]. It even handles list indexes in the path. You give it document_id (or the guarded document_id_link), field_path (default "text"), and a fallback string for when the field doesn't exist.

What you get back:

  • value - the field's value as a string (dicts and lists get JSON-serialized)
  • exists - BOOLEAN; true means the path actually resolved, false means you got the fallback
  • value_type - the Python type of what was found, so you know if it's a str, int, dict, etc.
  • json - full payload for debugging
  • value_items plus the standard selectable tail

There's a nice safety behavior hidden here: if you request text / raw_text and the stored value looks like binary garbage (the code scores text quality), it silently replaces it with a better text field from the same document and tells you which path it used in the payload. Handy when a document was saved by a buggy earlier write.

Install

Same pack as the rest:

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 exists output is your friend - if it's false, your path is wrong (or the document doesn't have it), and you're staring at the fallback, not real data. Don't trust value without checking exists at least once.

To find the right path, pair this with "06 Document Field Paths" - it flattens the whole document into dot-notated paths you can literally copy into field_path. That combo (Field Paths → Get Value) is the intended workflow for when you don't know a document's shape by heart.

One more gotcha: value is always a string on the way out, even if the stored thing was a number or bool. If you need to feed it into an INT socket, convert it downstream - the node doesn't type-coerce for you. And remember this is a read node; mutating fields is "06 Save Document Value's" job, and Save Value will refuse paths like _id that you shouldn't be touching.

CategoryZMongo/03 Documents

Inputs (8)

NameTypeDefaultDescription
sessionZMONGO_API_SESSION
document_idSTRING
field_pathSTRINGtext
fallbackSTRING
document_prefixSTRING/documents
document_id_linkopt*
field_path_linkopt*
refresh_tokenoptSTRING

Outputs (9)

NameTypeDescription
jsonSTRING
valueSTRING
existsBOOLEAN
value_typeSTRING
refreshSTRING
value_items*
selectable_items*
indexed_itemsSTRING
item_countINT