Files
supabase/apps/reference/_supabase_js_versioned_docs/version-v1/single.mdx
2022-08-15 11:18:27 +02:00

33 lines
620 B
Plaintext

---
id: single
title: 'single()'
slug: single
custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml
---
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
Retrieves only one row from the result. Result must be one row (e.g. using
`limit`), otherwise this will result in an error.
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.limit(1)
.single()
```
## Examples
### With `select()`
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.limit(1)
.single()
```