mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 04:45:08 +03:00
* `curl -sS https://supabase.github.io/postgrest-js/spec.json > spec/enrichments/tsdoc_v2/postgrest.json` * `cd spec && make transform generate.js.v2 format`
35 lines
650 B
Plaintext
35 lines
650 B
Plaintext
---
|
|
id: single
|
|
title: 'single()'
|
|
slug: /single
|
|
custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs'
|
|
import TabItem from '@theme/TabItem'
|
|
|
|
Return `data` as a single object instead of an array of objects.
|
|
|
|
Query result must be one row (e.g. using `.limit(1)`), otherwise this
|
|
returns 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()
|
|
```
|