Documentation Tutorials

Updating (MYSQL)

The following examples are using this migration:

db.table('users',{
  id: 'id',
  name: 'string',
  created: 'datetime'
})

All examples below are using these const definitions.

import {
  storage
} 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})