Spaces:
Sleeping
Sleeping
File size: 353 Bytes
4fdf18f | 1 2 3 4 5 6 7 8 9 10 11 12 13 | import os
from pymongo import MongoClient
from dotenv import load_dotenv
load_dotenv()
def get_db_client():
try:
client = MongoClient(os.getenv("MONGODB_URI"))
print("Connected to the database successfully")
return client
except Exception as e:
print(f"Error connecting to the database: {e}")
return None |