def count_characters(db):
    """Returns the number of characters from MongoDB database.

    Args:
        db (pymongo.database.Database): MongoDB database
    Returns:
        (int) Number of characters
    """
    agg_dict = [
        {
            "$count": "count"
        }
    ]
    agg_res = db["charactercreator.character"].aggregate(agg_dict)
    return list(agg_res)[0]["count"]