Update app files

This commit is contained in:
IgorVolochay
2025-01-26 16:20:25 +03:00
parent 3247f2c942
commit ad9048b7dc
2 changed files with 17 additions and 5 deletions
+4
View File
@@ -0,0 +1,4 @@
from mongo_worker import MongoWorker
if __name__ == "__main__":
print("Hello World!")
+13 -5
View File
@@ -1,7 +1,15 @@
import pymongo import pymongo
myclient = pymongo.MongoClient("mongodb://localhost:27017/") class MongoWorker():
db = myclient["data"] def __init__(self):
collections = db["game_data"] self.client = pymongo.MongoClient(host="127.0.0.1", port=27017)
print(myclient.list_database_names()) self.db = self.client["data"]
print(db.list_collection_names()) self.collection = self.db["game_data"]
def get_mongodb_info(self):
print(self.client.list_database_names())
print(self.db.list_collection_names())
if __name__ == "__main__":
mongo = MongoWorker()
mongo.get_mongodb_info()