LogicGoInfotechSpaces commited on
Commit
ea8f4fd
·
1 Parent(s): 3a7c1eb

Fix Mongo default database fallback

Browse files
Files changed (1) hide show
  1. app/db.py +2 -1
app/db.py CHANGED
@@ -54,7 +54,8 @@ def fetch_recent_transactions(user_id: str, months: int = 3) -> List[Transaction
54
  return []
55
 
56
  client = get_mongo_client()
57
- db = client.get_default_database() or client["expense"]
 
58
  collection = db["transactions"]
59
 
60
  user_obj_id = _safe_object_id(user_id)
 
54
  return []
55
 
56
  client = get_mongo_client()
57
+ default_db = client.get_default_database()
58
+ db = default_db if default_db is not None else client["expense"]
59
  collection = db["transactions"]
60
 
61
  user_obj_id = _safe_object_id(user_id)