Is this the proper way to do a count query?

rowsCount: (
  await db
    .select({ value: countDistinct(inventoryItems.id) })
    .from(inventoryItems)
    .where(whereFilter)
)[0].value


seems kinda weird to index 0 like that
Was this page helpful?