Instead of getting all databases here and then manually group them by Shard ID, we should be able to use an aggregation to retrieve the results already grouped by shard.