03 List Docs
Find documents without dragging the whole database out — ZMongo 03 List Docs
- session
- json
- ids
- indexed
03 List Docs is the lightweight "what's in this collection?" node. You give it a session, a collection, and optionally a filter, and it returns the matching document IDs - not the full documents, just the IDs. That's the point. When you want to browse what's stored before pulling individual records, this keeps the payload small and the workflow fast.
In the ZMongo mental model, a collection is a table and a document is a row. This node is the index page; 03 Get Doc and 03 Get Value are the detail pages you reach after. A typical pattern: List Docs → feed the ids list into 99 Select Nth Item to pick one → 03 Get Doc to fetch it. That's exactly how the pack's example workflows browse stored prompts and images.
How it works
The node takes your query_json filter, calls session.list_docs() with the collection, limit, and skip, then pulls the document IDs out of the response. It hands back three outputs:
json- the full response.ids- a list of document IDs, the useful one.indexed-"0: id"text for eyeballing the ordering in a preview.
Like every node in this pack it's AlwaysDirty, so it re-runs each time instead of caching results. Errors don't crash the graph - you get an error payload in json and empty lists.
The inputs and outputs that matter
session- required, from a00session node.collection_name- required, the collection to list.query_json- a filter in MongoDB-style JSON. Default{}means "everything". For example{"project_name": "default"}only lists docs in that project. Invalid JSON turns into an error payload.limit- 1–500, default 50.skip- how many to skip, for paging through big collections.
Outputs: json, ids (list), indexed. Note there's no success boolean here - check json for an error message when the lists come back empty.
Install
Standard for the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
cd ComfyUI-ZMongo
pip install -r requirements.txt
or use ComfyUI Manager (search "ComfyUI-ZMongo"), then restart. The heavy requirements are for embedding/vector features - this node just needs a working session.
Troubleshooting
- Empty
idswith an error injson- yourquery_jsondidn't parse, or the collection doesn't exist. Start with{}to confirm the collection itself is reachable, then add filter fields. - Empty
idswith a clean payload - the filter matched nothing. Check field names; ZMongo filters use the actual keys stored in the documents (e.g.project_name), so a typo silently matches zero rows. - Too many results - raise
limitor page withskip. The max is 500 per call. - Wrong data showing up - verify you're pointed at the right collection name and the right silo (
00 Who Am Iconfirmsdb_name). With the dual-backend setup it's easy to list the local store while your real data lives on the hosted API.
List Docs is unglamorous but it's the workhorse that starts most real ZMongo workflows.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| collection_name | STRING | — | |
| query_json | STRING | {} | — |
| limit | INT | 501–500 | — |
| skip | INT | 00–1000000 | — |
| refresh_tokenopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| json | STRING | — |
| ids | * | — |
| indexed | STRING | — |