Execute — everything MQDB can do, addressed by topic

MQDB exposes every operation (CRUD, schema, constraints, indexes, catalog, health) through a single db.execute(topic, payload) call. The topic decides which operation runs. This mirrors MQTT's request/response pattern, so the same code works whether you embed MQDB in a browser or talk to it via an MQTT broker.

How it works

flowchart LR
    T["Topic: $DB/users/42/update"] --> R[Router]
    P["Payload: { name: 'Bob' }"] --> R
    R --> O1[users/create]
    R --> O2[users/42 · read]
    R --> O3[users/42/update]
    R --> O4[users/42/delete]
    R --> O5[users/list]
    R --> A1[_admin/schema/users/set]
    R --> A2[_admin/constraint/users/add]
    R --> A3[_admin/index/users/add]
    R --> A4[_admin/catalog]
    R --> H[_health]
    style R fill:#b2dfdb,stroke:#00695c
    style T fill:#e0f2f1,stroke:#00695c
    style P fill:#e0f2f1,stroke:#00695c
                

Try it — a four-step tour

  1. Click the Health preset. That sets the topic to $DB/_health and payload to null. Click Execute to see { status: "ok", … }.
  2. Click the green Create product preset. Execute → you get back the new record with its generated id.
  3. Click List products → you see the record you just created.
  4. Scroll to Automated test suite and click Run all tests. 13 tests run in sequence, exercising the full topic surface (CRUD, schema, constraint, index, catalog, and invalid-topic rejection).

Execute a topic

Ready.

Result

Execute a command to see results

Presets

Lifecycle

CRUD on products

Admin on orders

Topic reference

TopicWhat it does
$DB/_healthLiveness / readiness check
$DB/_admin/catalogList all known entities
$DB/{entity}/createCreate a record (payload = fields)
$DB/{entity}/{id}Read a record
$DB/{entity}/{id}/updateUpdate a record (merge)
$DB/{entity}/{id}/deleteDelete a record
$DB/{entity}/listList records (payload = query options)
$DB/_admin/schema/{entity}/setRegister / replace schema
$DB/_admin/schema/{entity}/getFetch the schema
$DB/_admin/constraint/{entity}/addAdd unique / not_null / foreign key
$DB/_admin/constraint/{entity}/listList the entity's constraints
$DB/_admin/index/{entity}/addAdd a secondary index

Automated test suite

Run all tests exercises the full topic surface in 13 steps and reports pass/fail for each:

  1. Health check returns ok
  2. Create record via /create
  3. Read record via /{id}
  4. Update record via /{id}/update
  5. List records via /list
  6. Delete record via /{id}/delete
  7. Set schema via _admin/schema/…/set
  8. Get schema via _admin/schema/…/get
  9. Add constraint via _admin/constraint/…/add
  10. List constraints via _admin/constraint/…/list
  11. Add index via _admin/index/…/add
  12. Catalog via _admin/catalog
  13. Invalid topic is rejected
Click the button to run.

Log