The collections module provides structured data storage and querying for automations. It supports both MongoDB and SQL backends, with automatic namespace isolation per workspace and app.Documentation Index
Fetch the complete documentation index at: https://prismeai-legacy.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
run instruction for advanced use cases.Schema Management
updateSchema — Create or update a collection schema
updateSchema — Create or update a collection schema
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
schema | string | yes | Schema name |
properties | object | yes | Field definitions (name, type, nullable, etc.) |
indexes | array | no | Index definitions |
uniques | array | no | Unique constraint definitions |
oldCollection | string | no | Previous collection name (for renaming) |
oldSchema | string | no | Previous schema name (for renaming) |
createdAt, updatedAt, createdBy, and updatedBy fields.listCollections — List all collections
listCollections — List all collections
getCollectionSchemas — Get all schemas
getCollectionSchemas — Get all schemas
getCollectionStats — Get collection statistics
getCollectionStats — Get collection statistics
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
inferCollectionSchema — Infer schema from data
inferCollectionSchema — Infer schema from data
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | no | Infer from an existing collection |
data | object[] | no | Infer from sample data |
collection or data.deleteCollections — Delete collections
deleteCollections — Delete collections
| Parameter | Type | Required | Description |
|---|---|---|---|
collections | string[] | no | Specific collections to delete |
all | boolean | no | Delete all collections in the namespace |
Read Operations
findOne — Find a single document
findOne — Find a single document
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
query | object | yes | Filter criteria |
findMany — Find multiple documents
findMany — Find multiple documents
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
query | object | yes | Filter criteria |
opts.sort | object | no | Sort order (1 ascending, -1 descending) |
opts.limit | number | no | Maximum documents to return |
opts.page | number | no | Page number (1-indexed) |
opts.skip | number | no | Number of documents to skip |
opts.fields | string[] | no | Fields to include in results |
findAndCount — Find with total count
findAndCount — Find with total count
[entities, totalCount] — useful for paginated UIs.| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
query | object | yes | Filter criteria |
opts | object | no | Same options as findMany |
count — Count documents
count — Count documents
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
query | object | yes | Filter criteria |
distinct — Get distinct values
distinct — Get distinct values
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
query | object | yes | Filter criteria |
field | string | yes | Field to get distinct values for |
aggregate — Aggregation pipeline
aggregate — Aggregation pipeline
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
query | object | yes | Initial filter criteria |
steps | object[] | yes | Aggregation pipeline stages |
Write Operations
create — Insert a single document
create — Insert a single document
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
data | object | yes | Document to insert |
outputMode | string | no | "entity" to return full document, "simple" (default) to return { acknowledged, insertedId } |
createdAt and updatedAt are set automatically.bulkCreate — Insert multiple documents
bulkCreate — Insert multiple documents
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
data | object[] | yes | Documents to insert |
outputMode | string | no | "entity" for full documents, "simple" (default) for { acknowledged, insertedCount, insertedIds } |
Update Operations
updateOne — Update a single document
updateOne — Update a single document
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
query | object | yes | Filter to find the document |
data | object | yes | Fields to update |
allowMatchAll | boolean | no | Allow empty query (updates first match) |
updatedAt is set automatically. Returns { modifiedCount, matchedCount }.updateMany — Update multiple documents
updateMany — Update multiple documents
updateOne, but affects all matching documents.upsert — Insert or update
upsert — Insert or update
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
data | object | yes | Document data |
opts.onConflictFields | string[] | yes | Fields to match for conflict detection |
opts.onInsertValues | object | no | Additional values set only on insert |
outputMode | string | no | "entity" for full document, "simple" (default) for { acknowledged, upsertedCount, modifiedCount } |
createdAt is set only on insert; updatedAt is always set.Delete Operations
deleteOne — Delete a single document
deleteOne — Delete a single document
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | string | yes | Collection name |
query | object | yes | Filter to find the document |
allowMatchAll | boolean | no | Allow empty query |
{ deletedCount }.deleteMany — Delete multiple documents
deleteMany — Delete multiple documents
deleteOne, but deletes all matching documents.