S
Supabase2mo ago
Amir

Javascript SDK count property to only show the filtered result

Is there a way for the count property to only show the filtered results and not all the rows in the database?
const { data, count } = await supabase
.from('students')
.select('*', { count: 'exact' })
.in('status', ['active', 'blocked'])
const { data, count } = await supabase
.from('students')
.select('*', { count: 'exact' })
.in('status', ['active', 'blocked'])
I would like the count variable to only show the number of filtered results.
1 Reply
Max
Max2mo ago
That code is correct - count already shows filtered results. If you're getting unexpected numbers, check if your filter is actually working (typo in column/values?) or if all your rows happen to match the filter.

Did you find this page helpful?