Skip to main content

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 querydatabase, 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

FieldTypeDescription
driverstring (nullable)
conn_stringstring (nullable)
userstring (nullable)
passstring (nullable)
hoststring (nullable)
portnumber (nullable)
dbnamestring (nullable)
paramsstring (nullable)
auth_sourcestring (nullable)
max_open_connsnumber (nullable)
max_idle_connsnumber (nullable)
conn_max_lifetimeany
timeoutany
synchronousstring (nullable)SQLite-only: PRAGMA synchronous (OFF | NORMAL | FULL | EXTRA). Defaults to NORMAL (with WAL journaling) when unset — durable against application/process crashes and…

DocumentOperation

FieldTypeDescription
databasestringRequired.
collectionstringRequired.
operationstringRequired.
filterany
pipelineany
insertany
deleteany
updateany
optionsany