Modify data: update()

Performs an UPDATE on the table.

1final data = await supabase
2  .from('cities')
3  .update({ 'name': 'Middle Earth' })
4  .match({ 'name': 'Auckland' });

Notes#

  • update() should always be combined with Filters to target the item(s) you wish to update.

Examples#

Updating your data#

1final data = await supabase
2  .from('cities')
3  .update({ 'name': 'Middle Earth' })
4  .match({ 'name': 'Auckland' });

Updating JSON data#

Postgres offers a number of operators for working with JSON data. Right now it is only possible to update an entire JSON document, but we are working on ideas for updating individual keys.

1final data = await supabase
2  .from('users')
3  .update({
4    'address': {
5      'street': 'Melrose Place',
6      'postcode': 90210
7    }
8  })
9  .eq('address->postcode', 90210);