From 7011baff0fea4067773bb0de51eff8cc33fafd7f Mon Sep 17 00:00:00 2001 From: profitroll Date: Mon, 14 Aug 2023 13:51:18 +0200 Subject: [PATCH] Added db_client_sync --- modules/database.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/database.py b/modules/database.py index 65fe87d..405c55c 100644 --- a/modules/database.py +++ b/modules/database.py @@ -1,5 +1,5 @@ from async_pymongo import AsyncClient -from pymongo import GEOSPHERE +from pymongo import GEOSPHERE, MongoClient from modules.utils import configGet @@ -19,6 +19,7 @@ else: ) db_client = AsyncClient(con_string) +db_client_sync = MongoClient(con_string) db = db_client.get_database(name=db_config["name"]) @@ -29,4 +30,4 @@ col_videos = db.get_collection("videos") col_tokens = db.get_collection("tokens") col_emails = db.get_collection("emails") -col_photos.create_index([("location", GEOSPHERE)]) +db_client_sync[db_config["name"]]["photos"].create_index([("location", GEOSPHERE)])