06 Get Document Value
Pluck one field out of a document with dot notation
- session
- document_id_link
- field_path_link
- json
- value
- exists
- value_type
- refresh
- value_items
- selectable_items
- indexed_items
- item_count
"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;truemeans the path actually resolved,falsemeans you got the fallbackvalue_type- the Python type of what was found, so you know if it's a str, int, dict, etc.json- full payload for debuggingvalue_itemsplus 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.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| document_id | STRING | — | |
| field_path | STRING | text | — |
| fallback | STRING | — | |
| document_prefix | STRING | /documents | — |
| document_id_linkopt | * | — | |
| field_path_linkopt | * | — | |
| refresh_tokenopt | STRING | — |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| json | STRING | — |
| value | STRING | — |
| exists | BOOLEAN | — |
| value_type | STRING | — |
| refresh | STRING | — |
| value_items | * | — |
| selectable_items | * | — |
| indexed_items | STRING | — |
| item_count | INT | — |