Files
supabase/web/docs/client/update.mdx
T
ykdojo 0ae83a337e Test generating docs
I tried running npm run gen:supabase, and this is the result.
2020-12-22 12:48:50 -08:00

157 lines
2.6 KiB
Plaintext

---
id: update
title: "Modify data: update()"
slug: update
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Performs an UPDATE on the table.
<Tabs
defaultValue="js"
groupId="libraries"
values={[{ label: 'JavaScript', value: 'js' },{ label: 'Python', value: 'py' }]}>
<TabItem value="js">
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Middle Earth' })
.match({ name: 'Auckland' })
```
</TabItem>
<TabItem value="py">
```py
# Not yet implemented
```
</TabItem>
</Tabs>
## Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
values
</span>
<span className="method-list-item-label-badge required">
required
</span>
<span className="method-list-item-validation">
<code>Partial</code>
</span>
</h4>
<div class="method-list-item-description">
The values to update.
</div>
</li>
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
__namedParameters
</span>
<span className="method-list-item-label-badge required">
required
</span>
<span className="method-list-item-validation">
<code>object</code>
</span>
</h4>
<div class="method-list-item-description">
No description provided.
</div>
<ul className="method-list-group">
<h5 class="method-list-title method-list-title-isChild expanded">Properties</h5>
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
returning
</span>
<span className="method-list-item-label-badge required">
required
</span>
<span className="method-list-item-validation">
<code>minimal</code> | <code>representation</code>
</span>
</h4>
<div class="method-list-item-description">
By default the updated record is returned. Set this to 'minimal' if you don't need this value.
</div>
</li>
</ul>
</li>
</ul>
## Notes
- `update()` should always be combined with [Filters](/docs/client/using-filters) to target the item(s) you wish to update.
## Examples
### Updating your data
<Tabs
defaultValue="js"
groupId="libraries"
values={[{ label: 'JavaScript', value: 'js' },{ label: 'Python', value: 'py' }]}>
<TabItem value="js">
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Middle Earth' })
.match({ name: 'Auckland' })
```
</TabItem>
<TabItem value="py">
```py
# Not yet implemented
```
</TabItem>
</Tabs>