--- id: patch title: 'Updating' --- import DummyData from '../common/DummyData.mdx' import Collapsable from '../../src/components/Collapsable' import CommonResponses from '../common/CommonResponses.mdx' import CommonFilters from '../common/CommonFilters.mdx' We will be using these tables as reference for our examples: ### Update record This example how to update a country: ```js {8} import { createClient } from '@supabase/supabase-js' const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h') const updateCountryName = async () => { try { let updates = await supabase .patch('countries', { name: 'Middle Earth' }) .match({ name: 'New Zealand' }) return updates } catch (error) { console.log('Error: ', error) } } ``` @todo ## Reference ### `patch()` ```js supabase .patch(tableName, data, options?) ``` ##### tableName `:string` Name of table in the database where data will be saved. ##### data `:object` New record values. ##### options `:object?` ```js const options = { bulk: false // Protects against bulk updates. Set to true if you intend to perform a bulk change. } ``` ---- ## Filtering ## Responses #### 200 OK Successful