WIP: Migration to async_pymongo
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from pymongo import GEOSPHERE, MongoClient
|
||||
from async_pymongo import AsyncClient
|
||||
from pymongo import GEOSPHERE
|
||||
|
||||
from modules.utils import configGet
|
||||
|
||||
@@ -17,16 +18,10 @@ else:
|
||||
db_config["host"], db_config["port"], db_config["name"]
|
||||
)
|
||||
|
||||
db_client = MongoClient(con_string)
|
||||
db_client = AsyncClient(con_string)
|
||||
|
||||
db = db_client.get_database(name=db_config["name"])
|
||||
|
||||
collections = db.list_collection_names()
|
||||
|
||||
for collection in ["users", "albums", "photos", "videos", "tokens", "emails"]:
|
||||
if collection not in collections:
|
||||
db.create_collection(collection)
|
||||
|
||||
col_users = db.get_collection("users")
|
||||
col_albums = db.get_collection("albums")
|
||||
col_photos = db.get_collection("photos")
|
||||
|
Reference in New Issue
Block a user