02 Create Collection
Making the table before you fill it
- session
- json
- refresh
02 Create Collection stands up a new named collection in your ZMongo backend - think of it as creating a table (or folder) before you start dropping documents and images into it. If you've ever wished you could organize generations into logical buckets like prompts, images, or project_x_v1 instead of one flat dump, this is the node that makes the bucket exist.
The pack's whole pitch is decoupling values from the graph and parking them in a reusable parameter library - prompts, negative weights, runtime configs, rendered images. Collections are the top level of that organization, so this node is typically one of the first things in any serious ZMongo workflow.
How it works
Two required inputs:
session(ZMONGO_API_SESSION) - from the 00 API Key Session node.collection_name- the name of the collection to create. There's no validation here beyond what the backend enforces, so keep it lowercase and predictable if you want an easy time later.
Outputs:
json- the backend's response (success flag, message, status code).refresh- a dirty-token string. This is the pack's standard signal for "something changed, make downstream nodes re-run." Wire it into other nodes'refresh_tokeninputs to force a refresh of lists or counts.
Under the hood it calls the session's create_collection() against the hosted API. In Local File Store mode the same call just makes a directory; the collection concept carries over so your workflows don't care which backend they're on.
Tips
- Creating an existing collection usually isn't a hard error - most backends treat it as a no-op or return a "already exists" style message. So it's safe to leave a Create Collection node at the start of a workflow that runs repeatedly.
- If you're only ever going to use one or two buckets, you can skip this node entirely and let 03 Create Doc / 04 Easy Save Image create the collection on demand (their defaults point at collections like
images). This node is for when you want the schema explicit, or a collection that starts empty.
Install
ComfyUI Manager, search ComfyUI-ZMongo, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
The README's four-package install line is the short version; the real requirements.txt drags in langchain, pymongo, sentence-transformers and more. First run after install will be slow to import - that's the pack's document/vector machinery warming up, not a hang.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| collection_name | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| json | STRING | — |
| refresh | STRING | — |