Documentation Tutorials

Updating (MYSQL)

The following examples are using this migration:

  id: 'id',
  name: 'string',
  created: 'datetime'

All examples below are using these const definitions.

import {
} from 'js-web'

const { mysql } = storage

const users = mysql.table('users')

How to update

Use the update(updates,where) function on the return object from the table function. In the example below, the users is const users = db.table('users')

users.update({name: 'Simon M'},{name: 'Simon'})
users.update({name: 'Simon M'},{id:1})