Flatten relation count?

There is any way to flatten the products_count?

const { data } = await supabase
  .from('categories')
  .select('id, name, updated_at, products(count)', { count: 'exact' })


{
  "data": [
    {
      "id": 1,
      "name": "Quesos",
      "updated_at": "2023-12-09T16:40:05.250842+00:00",
      "products": [
        { "count": 2 }
      ]
    }
  ],
  "count": 1
}
Was this page helpful?