Skip to main content
Version: v2 RC

maybeSingle()

Return data as a single object instead of an array of objects.

Query result must be zero or one row (e.g. using .limit(1)), otherwise this returns an error.

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

Examples

With select()

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