filtering on child, but not select

I'm pulling a tag cloud, but I don't want to pull tags from posts that are not published. This works as expected:
    const { data, error: _error, count } = await supabase
        .from('tags')
        .select('*, post_tag!inner(posts!inner())', { count: 'exact' })
        .eq('post_tag.posts.status', 'published')
        .order('tag_count', { ascending: false });

However, I get an empty post_tag, which I don't actually want to select:
  {
    tag_id: 'f15ca8b0-70ee-4096-aee0-eef4580827eb',
    name: 'Firebase',
    created_at: '2023-12-06T03:27:39.647512+00:00',
    updated_at: '2023-12-06T03:27:39.647512+00:00',
    post_tag: [ {}, {}, {}, {} ]
  },

Is there a way to filter by posts (where status = 'published'), without actually selecting the post_tag. In sql, you do the join without selecting that column...

J
Was this page helpful?