06 Document Field Paths
The X-ray that shows you every field hiding inside a document
- session
- document_id_link
- collection_name_link
- json
- field_paths_json
- indexed_field_paths
- count
- success
- refresh
- field_paths
- selectable_items
- indexed_items
- item_count
ZMongo documents are nested dicts, and nested dicts are opaque. "06 Document Field Paths" fixes that: point it at a document and it flattens the entire structure into a list of dot-notated paths - metadata.note, document_text.line_count, source_file.filename, every last one. It's the discovery tool you use before Get Value / Save Value, so you're guessing at field names instead of reading them.
How it works
It calls /api/field-paths/{document_id} to get the flattened paths from the backend. If your session doesn't implement that route - which is true for Local File Store mode - it falls back to fetching the document and flattening it locally with the same logic. So it works in both hosted and local modes, which is more than you can say for some of this pack's endpoints.
Inputs: session, collection_name (default documents - set it to text_documents for ingested docs), document_id (or the guarded document_id_link), and document_prefix. Outputs: field_paths_json (the paths as JSON), indexed_field_paths (numbered, human-readable), count (how many paths were found), success, plus field_paths as a real list - which is the one to route into an Index Selector if you want to iterate or pick one.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
Restart ComfyUI, or install "ComfyUI-ZMongo" via ComfyUI Manager.
Where people get burned
Same collection gotcha as everywhere in this suite: the default collection_name is documents, but if the document was created by the Ingest node it lives in text_documents by default. Wrong collection → empty path list, even though the document exists. Match the collection and re-run.
Second, this node tells you the shape of one document. Documents in the same collection can have different fields, especially if you've been saving values ad hoc with Save Value. If Field Paths shows a path but Get Value says it doesn't exist, you're probably looking at a different document than the one you're reading - check the ID.
And a heads-up on scale: a document with big arrays produces a long path list. That's expected, but it's why the count and indexed_field_paths outputs exist - they make a wall of paths actually skimmable. This is a genuinely useful node, but it's a tool for reading, not for end-to-end automation; you'll use it when you're building a workflow, then remove it before you ship the workflow to something that runs it every day.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| collection_name | STRING | documents | — |
| document_id | STRING | — | |
| document_prefix | STRING | /documents | — |
| document_id_linkopt | * | — | |
| collection_name_linkopt | * | — | |
| refresh_tokenopt | STRING | — |
Outputs (10)
| Name | Type | Description |
|---|---|---|
| json | STRING | — |
| field_paths_json | STRING | — |
| indexed_field_paths | STRING | — |
| count | INT | — |
| success | BOOLEAN | — |
| refresh | STRING | — |
| field_paths | * | — |
| selectable_items | * | — |
| indexed_items | STRING | — |
| item_count | INT | — |