def get_types_distribution(articles):
    """
    :param articles: PyMongo collection of articles
    :return: Dictionary with article types as keys, and number of articles of
    type as value
    """
    cursor = articles.aggregate(
        [{"$group": {"_id": "$doc_type", "count": {"$sum": 1}}}]
    )

    result = {}
    for rec in cursor:
        result[rec["_id"]] = rec["count"]

    return result