So counting the top tags has not been a problem as I just do the aggregation on the collection. However how do I find also tags that exist in Tags but not in Pages. Ideally I would like to get a result with the missing Tags counted as 0.
There must be something I do not understand because it sounds like a very simple pipeline with a lookup and a match should provide you with what you are looking for. Something like the untested:
There are elements in Tags not present in Pages, and I need to count both presence and absence. When I ran the aggregation only on Pages, I get only the present tags not the missing ones, does it make sense?
Your pipeline is essentially the same as mine with the following differences.
An extra $match at the beginning for type:generic which was not mentioned in your original post.
Field names in localField and foreignField that seems wrong compared to your sample documents. The localField:_id seems to be an ObjectId while foreignField:tags._id seems to be UUID. They could not match. I used localField:name and foreignField:tags.name because they were the only that could be matched.
My $limit:1 and final $match wrongly assumed that you only wanted the unused tags.