Files
supabase/web/docs/library/delete.mdx
T

81 lines
1.3 KiB
Plaintext

---
id: delete
title: 'Deleting'
---
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:
<DummyData />
### Delete records
This example how to delete a city:
<!-- prettier-ignore -->
```js {8-9}
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.io', '1a2b-3c4d-5e6f-7g8h')
const updateCountryName = async () => {
try {
let values = await supabase
.match({ id: 666 })
.delete('cities', { name: 'Mordor' })
return values
} catch (error) {
console.log('Error: ', error)
}
}
```
<Collapsable title="Toggle Example Response">
@todo
</Collapsable>
## Reference
### `delete()`
```js
supabase
.delete(tableName, options?)
```
##### tableName `:string`
Name of table in the database with the data that should be deleted.
##### options `:object?`
```js
const options = {
bulk: false // Protects against bulk updates. Set to true if you intend to perform a bulk change.
}
```
----
## Filtering
<CommonFilters verb="delete" />
## Responses
#### 200 OK
Successful
<CommonResponses />