04 Browse Collection Images
Your ZMongo store as a contact sheet
- session
- image_batch
- selected_image
- json
- document_ids
- indexed_document_ids
- selected_document_id
- count
- status
04 Browse Collection Images is the reading side of ZMongo's image storage: it pulls saved images back out of a collection and hands them to ComfyUI as tensors you can actually preview, pass to a sampler, or feed to an image-to-image pipeline. Save with 04 Easy Save Image, browse with this. They're the pair that makes the database a real asset library instead of a black box.
The source's docstring is refreshingly concrete about the workflow: use it with ComfyUI's built-in Preview Image node - image_batch shows a grid from the collection/page, selected_image shows the one you picked via selected_index.
How it works
The node lists documents from a collection, decodes each one's image field locally when it can, and falls back to a backend image route when the data is server-side only. No new backend endpoint needed - it reuses the API session.
Required inputs that matter:
session- from the API Key Session node.collection_name- defaults toimages.field_path- the field holding the image bytes, defaultimage_data.query_json- Mongo-style filter (default{}= everything).limit/skip- paging; limit caps at 64.selected_index- which image in the batch becomesselected_image.thumbnail_width/thumbnail_height- the batch canvas size, default 512×512. Every frame gets letterboxed onto this canvas so the batch is a uniform shape (important - ComfyUI batches need matching dimensions).
Outputs are the richest in the pack:
image_batch- all images in the page as oneIMAGEtensor.selected_image- the single image atselected_index.json- the raw list-docs payload.document_ids- list of ids on the page.indexed_document_ids- the same ids as a numbered string list ("0: abc", "1: def"), for feeding into selector nodes.selected_document_id- the id of your selected image. This is the gold output: wire it into a Get Doc or a Gemini-from-doc node and you've got a full "browse → pick → process" loop.count- how many documents matched.status- human-readable state, useful for debugging.
Gotchas
- Batch images are letterboxed onto the thumbnail canvas with black bars, so a contact sheet looks tidy but the actual pixels are padded. Preview with
selected_image(which is decoded natively) when you care about exact pixels. master_key_hexis an optional decryption key for images stored encrypted server-side - leave blank unless your backend uses it.- The
cacheoption exists because listing/decoding can be slow on big collections; a cached browse is fast but can serve stale rows.
Install
ComfyUI Manager → ComfyUI-ZMongo, or clone:
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
restart, then let the first import churn through the pack's heavy requirements.txt. The image nodes need pillow/numpy/torch - the rest (langchain, pymilvus, …) is installed but unused here.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| collection_name | STRING | images | — |
| field_path | STRING | image_data | — |
| query_json | STRING | {} | — |
| limit | INT | 121–64 | — |
| skip | INT | 00–1000000 | — |
| selected_index | INT | 00–1000000 | — |
| thumbnail_width | INT | 51264–4096 | — |
| thumbnail_height | INT | 51264–4096 | — |
| master_key_hexopt | STRING | — | |
| cacheopt | BOOLEAN | false | — |
| refresh_tokenopt | STRING | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| image_batch | IMAGE | — |
| selected_image | IMAGE | — |
| json | STRING | — |
| document_ids | * | — |
| indexed_document_ids | STRING | — |
| selected_document_id | STRING | — |
| count | INT | — |
| status | STRING | — |