ComfyUI Node

03 Get Doc

Pull a whole document out of the database — ZMongo 03 Get Doc

By CentralFloridaAttorney·Created 5 months ago·Updated 2 months ago· 1
03 Get Doc
  • session
  • json
  • success
collection_name
document_id
cachefalse
refresh_token

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, default false. 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: false with "No session provided." - the session input isn't connected. Every DB node in this pack needs one.
  • success: false and 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.
  • json has a document but looks empty - check the shape of the payload. Get Doc returns the raw envelope, and ZMongo binary fields (like image_data) are stored as opaque bytes envelopes, not human-readable content. Use 04 Metadata Flattened Paths to discover which fields actually exist.
  • Slow repeated reads - if you're polling the same document, try cache: true and 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.

CategoryZMongo/02 Docs

Inputs (5)

NameTypeDefaultDescription
sessionZMONGO_API_SESSION
collection_nameSTRING
document_idSTRING
cacheBOOLEANfalse
refresh_tokenoptSTRING

Outputs (2)

NameTypeDescription
jsonSTRING
successBOOLEAN