Databases
Define a database in global.databases (reused across actions) or inline on an
action. Connect with a driver + conn_string, or with discrete
user/pass/host/dbname fields — don't mix the two.
Supported drivers: postgres, mysql, mssql, sqlite, mongodb
(also Azure Cosmos DB and Amazon DocumentDB via the MongoDB driver).
global:
databases:
main:
driver: postgres
conn_string: "postgresql://a|env::PG_USER|:a|env::PG_PASS|@a|env::PG_HOST|/app"
interfaces:
users:
method: GET
actions:
- name: List
database: main
query: SELECT * FROM users
Document stores
NoSQL / document stores use a document_operation block instead of query —
database, collection, operation (find, findOne, insertOne,
updateMany, aggregate, …) and the relevant filter / pipeline / insert /
update / delete / options. Full fields are in the DocumentOperation type
below.
Database
| Field | Type | Description |
|---|---|---|
driver | string (nullable) | |
conn_string | string (nullable) | |
user | string (nullable) | |
pass | string (nullable) | |
host | string (nullable) | |
port | number (nullable) | |
dbname | string (nullable) | |
params | string (nullable) | |
auth_source | string (nullable) | |
max_open_conns | number (nullable) | |
max_idle_conns | number (nullable) | |
conn_max_lifetime | any | |
timeout | any | |
synchronous | string (nullable) | SQLite-only: PRAGMA synchronous (OFF | NORMAL | FULL | EXTRA). Defaults to NORMAL (with WAL journaling) when unset — durable against application/process crashes and… |
DocumentOperation
| Field | Type | Description |
|---|---|---|
database | string | Required. |
collection | string | Required. |
operation | string | Required. |
filter | any | |
pipeline | any | |
insert | any | |
delete | any | |
update | any | |
options | any |