Spaces:
Runtime error
Runtime error
| 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 |