One can get a count on how many collections of each type there are in a cluster by running db.serverStatus().catalogStats. Those counters are managed by the CollectionCatalog, which keeps a CollectionCatalog::Stats data structure up to date with the catalog's contents.
The code to increment and decrement those counters is (and must be) almost identical.
Extract a common method to ensure we can not introduce bugs that get them out of sync.
Potentially this method can belong to CollectionCatalog::Stats so that it becomes decoupled from the large CollectionCatalog class.