Skip to content

Commit

Permalink
feat: Using Module database for getting communties!
Browse files Browse the repository at this point in the history
  • Loading branch information
amindadgar committed Jan 11, 2024
1 parent f2aef3d commit 00a6669
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 00a6669

Please sign in to comment.