03 Get Doc
Pull a whole document out of the database — ZMongo 03 Get Doc
- session
- json
- success
03 Get Doc fetches one complete document by ID. If ZMongo is your prompt hub - a database where you stash structured prompt documents, generation parameters, and image metadata instead of hardcoding them in the graph - this is the "load the row" node. You know which collection and which document you want, and you want the whole thing back as JSON.
Where does the document ID come from? Usually from 03 List Docs or 03 Query Docs, which return ids lists. So the shape of a ZMongo read workflow is: find IDs → pick one → Get Doc → pull individual fields out with 03 Get Value or 99 JSON Pick. Get Doc is the middle step that hands you the full record so you can decide what to do with it.
How it works
The node calls session.get_doc() with the collection and document ID, then returns the raw response as JSON text plus a success boolean. That's the whole mechanism - it's a thin wrapper around the session, which itself talks to either the hosted API or the local file store depending on which session node you fed it.
Two details worth knowing. First, the cache input: it defaults to false, and the pack's nodes are AlwaysDirty (they re-run every execution), so by default you always get a fresh read. Flip cache on if you're hammering the same document and want to lean on backend caching instead. Second, a missing or invalid document ID doesn't crash - you get success: false and an error payload in json, which is the pack's standard defensive style.
The inputs and outputs that matter
session- required.collection_name- required, e.g.prompts.document_id- required, the ID you got from a list/query node.cache- boolean, defaultfalse. Leave off for always-fresh reads.
Outputs: json (the full document as a JSON string - wire it to a preview to inspect) and success (boolean). The document's actual fields are inside json; use 99 JSON Pick with a dot-path like positive_prompt to turn a nested field into a plain string for a CLIP text encoder.
Install
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
cd ComfyUI-ZMongo
pip install -r requirements.txt
or ComfyUI Manager → "ComfyUI-ZMongo" → install → restart. No special model downloads; this node just needs a session.
Troubleshooting
success: falsewith "No session provided." - thesessioninput isn't connected. Every DB node in this pack needs one.success: falseand the ID came from a previous run - you may have a stale ID. List Docs again; the document might have been deleted or your collection name changed.jsonhas a document but looks empty - check the shape of the payload. Get Doc returns the raw envelope, and ZMongo binary fields (likeimage_data) are stored as opaquebytesenvelopes, not human-readable content. Use04 Metadata Flattened Pathsto discover which fields actually exist.- Slow repeated reads - if you're polling the same document, try
cache: trueand see whether the latency drops. Just remember cached data is only as fresh as the backend's cache policy.
Get Doc is the simplest of the read nodes and, for a lot of workflows, the one you actually want before reaching for the fancier query machinery.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| collection_name | STRING | — | |
| document_id | STRING | — | |
| cache | BOOLEAN | false | — |
| refresh_tokenopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| json | STRING | — |
| success | BOOLEAN | — |