Nodes/ComfyUI-ZMongo/06 List Documents
ComfyUI Node

06 List Documents

Browse your document collection like it's a folder you can query

By CentralFloridaAttorney·Created 5 months ago·Updated 2 months ago· 1
06 List Documents
  • 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
query_json{}
sort_json[["updated_at", -1]]
limit50
skip0
include_file_datafalse
document_prefix/documents
refresh_token

"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 documents
  • document_ids_json / document_ids - just the IDs, as JSON and as a ComfyUI list
  • filenames_json / filenames - just the filenames
  • first_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 standard selectable_items / indexed_items / item_count tail

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.

CategoryZMongo/03 Documents

Inputs (8)

NameTypeDefaultDescription
sessionZMONGO_API_SESSION
query_jsonSTRING{}
sort_jsonSTRING[["updated_at", -1]]
limitINT501–500
skipINT00–1000000
include_file_dataBOOLEANfalse
document_prefixSTRING/documents
refresh_tokenoptSTRING

Outputs (14)

NameTypeDescription
jsonSTRING
documents_jsonSTRING
document_ids_jsonSTRING
filenames_jsonSTRING
first_document_id_linkZMONGO_DOCUMENT_ID
first_filename_linkZMONGO_FILENAME
countINT
successBOOLEAN
refreshSTRING
document_ids*
filenames*
selectable_items*
indexed_itemsSTRING
item_countINT