Skip to main content

maybeSingle()

Retrieves at most one row from the result. Result must be at most one row (e.g. using eq on a UNIQUE column), otherwise this will result in an error.

const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.eq('name', 'Singapore')
.maybeSingle()

Examples

With select()

const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.eq('name', 'Singapore')
.maybeSingle()