06 List Documents
Browse your document collection like it's a folder you can query
- session
- json
- documents_json
- document_ids_json
- filenames_json
- first_document_id_link
- first_filename_link
- count
- success
- refresh
- document_ids
- filenames
- selectable_items
- indexed_items
- item_count
"06 List Documents" is the front door to everything else in the ZMongo document suite. It queries the document collection and hands you the matching documents - which means it's also the node you'll wire the output of into basically everything downstream. If you've saved documents with Ingest or Upload and you can't see them, this is where you look first.
How it works
It POSTs a query to the /api/list endpoint. The query itself is plain JSON - that's the query_json input, default {}, which means "everything." Want only documents tagged a certain way, or with a specific metadata field? Put the MongoDB-style filter there. sort_json defaults to [["updated_at", -1]] (newest first), and limit (default 50, max 500) plus skip (default 0) give you basic pagination. include_file_data (default false) matters if your documents carry binary image/file payloads - flip it on and the response includes the file data, at the cost of a much bigger transfer.
The outputs are the useful part, because they're pre-split so you don't have to parse JSON:
documents_json- the raw list of documentsdocument_ids_json/document_ids- just the IDs, as JSON and as a ComfyUI listfilenames_json/filenames- just the filenamesfirst_document_id_link/first_filename_link- convenience outputs for the first hit, typed as ZMongo links so they plug straight into "Get Document" or "Get Document Text"count,success,refresh, and the standardselectable_items/indexed_items/item_counttail
The document_ids list output is the one you'll most often route into "06 Document Index Selector" or "06 Select Nth Document Item" to pick a specific record.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
Restart, or grab it via ComfyUI Manager ("ComfyUI-ZMongo").
Where people get burned
The classic mistake is treating query_json like a full MongoDB query document when it's actually just the filter - you don't need to wrap it in {"query": ...}. Keep it as a plain filter object. If you pass garbage JSON, the node parses it to {} and silently lists everything, which is confusing if you expected a filtered result.
Also: limit caps at 500. If you have more documents than that and you're seeing a suspiciously round number like 50 or 500, that's the default/max, not an empty result. Bump skip and page through, or tighten query_json. And if the list comes back empty, the first question is always the session - a fresh Local File Store session starts with zero documents until you've saved something into it, so an empty list on a brand-new workflow is expected, not a bug.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| query_json | STRING | {} | — |
| sort_json | STRING | [["updated_at", -1]] | — |
| limit | INT | 501–500 | — |
| skip | INT | 00–1000000 | — |
| include_file_data | BOOLEAN | false | — |
| document_prefix | STRING | /documents | — |
| refresh_tokenopt | STRING | — |
Outputs (14)
| Name | Type | Description |
|---|---|---|
| json | STRING | — |
| documents_json | STRING | — |
| document_ids_json | STRING | — |
| filenames_json | STRING | — |
| first_document_id_link | ZMONGO_DOCUMENT_ID | — |
| first_filename_link | ZMONGO_FILENAME | — |
| count | INT | — |
| success | BOOLEAN | — |
| refresh | STRING | — |
| document_ids | * | — |
| filenames | * | — |
| selectable_items | * | — |
| indexed_items | STRING | — |
| item_count | INT | — |