Database
The Database block gives your workflows a structured data store that lives inside your workspace -- no external database service required. Create collections and tables, define a schema, and run full CRUD (query, insert, update, delete) operations against your own data, all with workspace-scoped authentication handled for you.
Overview
The Database block enables you to:
Store structured data without leaving Mandala: Maintain workflow state, user preferences, task progress, or a lightweight CRM entirely inside your workspace
Run full CRUD operations: Query, insert, update, and delete rows -- plus manage table/column schema directly from the block
Let AI write your filters and data: The built-in AI wand turns a plain-language description into the JSON filter or row data the operation needs
Update or delete without a separate query first: Identify the target row by a filter (e.g. an email) in the same block, instead of querying for its id in one block and acting on it in another
How It Works
Selects a collection and table, then retrieves rows -- optionally narrowed by a JSON Filter and capped by Limit (default 50). The AI wand can generate the filter from a plain-language description once a table is selected, using that table's real column names.
Adds either a Row (JSON Data matching the table's columns) or a Column (name, type, required/unique, default value). System columns (id, created_at, updated_at, deleted_at) are added automatically -- never include them yourself.
Modifies either a Row or a Column. A row can be found by its Row ID or by a Filter -- the filter path resolves the matching row and updates it in one block, rather than requiring a separate query step first.
Removes either a Row (soft delete -- see below) or a Column, identified the same two ways (Row ID or Filter) as Update.
Reads schema/data information instead of mutating anything: Tables (what tables exist in a collection), Columns (a table's schema), or Rows (same as Query, listed under a different label).
Deletes are soft deletes -- a deleted row is marked with a deleted_at timestamp rather than being removed, so data stays recoverable.
Configuration Options
Operation - Query, Insert, Update, Delete, or List.
Database Collection / Table - Selected from your workspace's existing collections and tables; the table selector only populates once a collection is chosen.
Filter (optional) - A JSON object matched with AND logic across every field, e.g. {"status": "active", "role": "admin"}. A field can also take an array to match any of several values, e.g. {"role": ["admin", "moderator"]}.
Find Row By (Update/Delete of a row) - Row ID to target a specific id directly, or Filter to resolve the row from a JSON filter in the same step.
Data (Insert/Update of a row) - JSON object of column values. For Insert, all required columns must be present; for Update, include only the fields you're changing.
Run List → Columns first to see a table's real column names and types before writing a Filter or Data value by hand -- the AI wand does this automatically when generating a filter or row data for you.
Best Practices
- Discover the schema first:
List → Columnsbefore inserting or filtering, so field names and types are exact. - Prefer filter-based update/delete over a separate query step: it's one block instead of two, as long as your filter matches exactly one row.
- Let the AI wand write JSON for you: it already has the table's schema as context, so it rarely gets field names wrong the way a hand-typed filter can.
- Set a
Limiton queries: the default (50) is a reasonable ceiling, but size it to what the workflow actually needs. - Remember deletes are soft: a "deleted" row still exists with
deleted_atset -- don't rely on it disappearing from anything that reads the table directly.
Full Reference
Every operation, parameter, and output shape -- including the AI wand's auto-generation heuristics for uuid/timestamp columns -- is documented in full at Database (tools).
Inputs and Outputs
Operation: query, insert, update, delete, or list
Database Collection / Table: the target collection and table
Filter: JSON object narrowing which rows a query/list/update/delete affects
Data: JSON object of row values for Insert/Update
rows: matched rows, for Query and List Rows
tables / columns: schema info, for List Tables/Columns
id / data: the affected row's id and value, for Insert/Update/Delete
count: number of items returned by a Query or List operation