Is there anyway to return count as a single value, not an object in an array?

When doing a join like so:
 const { data, error } = await supabase
        .from(LISTINGS_TABLE)
        .select("*, comments:listingComments(count), likes:listingLikes(count)", { count: "estimated" })

I then have to access the amount of comments as listing?.comments[0]?.count. Same thing with the likes: listing?.likes[0]?.count

I'd ideally like to just use listing?.likes?.count or even better listing?.likes
Was this page helpful?