Skip to main content
Version: v1

Modify data: update()

Performs an UPDATE on the table.

const { data, error } = await supabase
.from('cities')
.update({ name: 'Middle Earth' })
.match({ name: 'Auckland' })

Parameters

  • valuesrequiredPartial

    The values to update.

  • __namedParametersrequiredobject

    No description provided.

      Properties
    • countoptionalliteral | exact | planned | estimated

      No description provided.

        Properties
      • estimatedrequiredliteral

        No description provided.

      • plannedrequiredliteral

        No description provided.

      • exactrequiredliteral

        No description provided.

      • nullrequiredliteral

        No description provided.

    • returningoptionalminimal | representation

      No description provided.

        Properties
      • representationrequiredliteral

        No description provided.

      • minimalrequiredliteral

        No description provided.

Notes

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

Examples

Updating your data

const { data, error } = await supabase
.from('cities')
.update({ name: 'Middle Earth' })
.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.

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