SERVER / DATABASE / WRITE

Update

Update applies a patch to records selected by a static table and equality filter, then returns a change result through its query binding.

Delete records

PATCH

Filter by authority, then return fresh data

Use where to select the record. required:true produces a controlled 404 when no matching record exists. A subsequent read can return the refreshed record.

dowe
handler updateBlog req
  db db name:"content"
  let body = req.body
  query updated db:db.update table:"blogs" where:{ id:req.params.id } value:{ title:body.title content:body.content updatedAt:now } required:true
  query blog db:db.read table:"blogs" where:{ id:req.params.id } required:true
  return response json:{ ok:true changed:updated data:blog }

Equality filters

where identifies records by declared equality fields. Keep ownership fields such as id on the server side.

Patch only

value contains the permitted fields to change. Request values do not choose Database configuration.