Kadak

Update

Update rows safely with explicit filter + patch.

Update

Problem: update queries can accidentally touch too many rows.

Solution: always pass a tight filter as the first argument.

Update by id

const rows = await db.users.update(
  { id: 1 },
  { isActive: false },
)

Update multiple rows

const rows = await db.users.update(
  { isActive: true },
  { isActive: false },
)

What KadakORM prevents

If your update patch is empty, KadakORM throws VALIDATION_ERROR instead of sending a broken query.

Important: no filter means a full-table update. Always include a filter.

On this page