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
+13 -5
View File
@@ -1,7 +1,15 @@
import pymongo
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
db = myclient["data"]
collections = db["game_data"]
print(myclient.list_database_names())
print(db.list_collection_names())
class MongoWorker():
def __init__(self):
self.client = pymongo.MongoClient(host="127.0.0.1", port=27017)
self.db = self.client["data"]
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()