diff --git a/dags/hivemind_etl_helpers/src/utils/get_mongo_discord_communities.py b/dags/hivemind_etl_helpers/src/utils/get_mongo_discord_communities.py index 7b383ade..b8f54ab9 100644 --- a/dags/hivemind_etl_helpers/src/utils/get_mongo_discord_communities.py +++ b/dags/hivemind_etl_helpers/src/utils/get_mongo_discord_communities.py @@ -3,14 +3,17 @@ def get_all_discord_communities() -> list[str]: """ - Getting all communities having discord from database + Getting all communities having discord from database for hivemind ETL """ mongo = MongoSingleton.get_instance() - communities = ( - mongo.client["Core"]["platforms"] - .find({"name": "discord"}) - .distinct("community") + cursor = mongo.client["Module"]["modules"].find( + { + "name": "hivemind", + }, + {"communityId": 1, "_id": 0}, ) - # getting the str instead of ObjectId - communities = [str(comm) for comm in communities] + results = list(cursor) + + # getting the community id + communities = [str(hivemind_module["communityId"]) for hivemind_module in results] return communities