06 Create Text Document
Create a text document in ZMongo straight from a string input
- session
- json
- document_id
- document_id_link
- filename
- filename_link
- text_length
- success
- refresh
- document_ids
- filenames
- selectable_items
- indexed_items
- item_count
The document side of ComfyUI-ZMongo is about turning your database into a structured text store - prompts, captions, run logs, LLM context. 06 Create Text Document is the node that writes a document into that store, built entirely from a string input rather than a file on disk. You type (or wire) the text, it becomes a record.
It needs a session (the ZMONGO_API_SESSION from 00 API Key Session or 00 Local File Store Session) and hits the backend's /api/create endpoint under the document_prefix (default /documents). The payload bundles your inputs: filename (default manual_document.txt), the text itself, an optional case_id for grouping, metadata_json for arbitrary key/values, and document_json for structured payload fields. The server also records a content type and the character count, so the document looks like a first-class record, not a loose string.
What you set
filename- the display name of the document. This is what you'll see in list nodes later, so name it something you'd recognize in a list of hundreds.text- the content. It's a multiline field, so paste freely.case_id- optional grouping tag for when you're organizing documents by project or run.metadata_json/document_json- the structured extras.metadata_jsonis the go-to for searchable tags;document_jsonlets you embed a full structured payload alongside the text.
Outputs
The useful ones: document_id (string) and document_id_link (a ZMONGO_DOCUMENT_ID typed socket for feeding other document nodes), filename and filename_link the same way, text_length (handy sanity check that your text actually landed), success, and refresh. The document_ids / filenames list outputs plus the selectable_items / indexed_items / item_count tail feed the pack's "select from a list" pattern downstream - e.g. pipe selectable_items into an index selector.
Notes and gotchas
This is an output node (is_output_node: true), so running it surfaces the result in the UI. The heavy lifting happens on the backend, so a failed call shows up in the json output with the server's message - and if the route isn't found, the node falls back to a generic document-create path, so it's fairly resilient across backend versions. Because everything is stored via your session, no credentials means no persistence: the local file store session works, but the hosted path needs a valid API key for the username that owns the silo.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| session | ZMONGO_API_SESSION | — | |
| filename | STRING | manual_document.txt | — |
| text | STRING | — | |
| case_id | STRING | — | |
| metadata_json | STRING | {} | — |
| document_json | STRING | {} | — |
| document_prefix | STRING | /documents | — |
| refresh_tokenopt | STRING | — |
Outputs (13)
| Name | Type | Description |
|---|---|---|
| json | STRING | — |
| document_id | STRING | — |
| document_id_link | ZMONGO_DOCUMENT_ID | — |
| filename | STRING | — |
| filename_link | ZMONGO_FILENAME | — |
| text_length | INT | — |
| success | BOOLEAN | — |
| refresh | STRING | — |
| document_ids | * | — |
| filenames | * | — |
| selectable_items | * | — |
| indexed_items | STRING | — |
| item_count | INT | — |