JavaScript: Update data

Perform an UPDATE on the table or view.

By default, updated rows are not returned. To return it, chain the call with .select() after filters.

Parameters

Examples

Updating your data

const { error } = await supabase
  .from('instruments')
  .update({ name: 'piano' })
  .eq('id', 1)

Update a record and return it

const { data, error } = await supabase
  .from('instruments')
  .update({ name: 'piano' })
  .eq('id', 1)
  .select()

Updating JSON data

const { data, error } = await supabase
  .from('users')
  .update({
    address: {
      street: 'Melrose Place',
      postcode: 90210
    }
  })
  .eq('address->postcode', 90210)
  .select()