Campus-Agent / database.py
167AliRaza's picture
Create database.py
4fdf18f verified
raw
history blame contribute delete
353 Bytes
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