Skip to content

Commit 23b2423

Browse files
committed
fix: Clean up linting issues and add collection accessor methods
1 parent bcb516e commit 23b2423

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

app/database/mongo_connection.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import os
99
import logging
1010
from dataclasses import dataclass
11-
from typing import Optional, Dict, Any, List, Union
11+
from typing import Optional, Dict, Any, List
1212
from datetime import datetime
1313
import asyncio
1414

@@ -19,12 +19,9 @@
1919
)
2020
from pymongo.errors import (
2121
ConnectionFailure,
22-
ServerSelectionTimeoutError,
23-
OperationFailure,
24-
ConfigurationError
22+
OperationFailure
2523
)
2624
from pymongo import ASCENDING, TEXT
27-
from bson import ObjectId
2825

2926
logger = logging.getLogger(__name__)
3027

@@ -189,7 +186,7 @@ async def _connect_atlas(self) -> bool:
189186
self._connected = True
190187
self._is_atlas = True
191188

192-
logger.info(f"✅ MongoDB Atlas connected successfully")
189+
logger.info("✅ MongoDB Atlas connected successfully")
193190
logger.info(f" Database: {self._config.db_name}")
194191
logger.info(f" Vector Search: {'Available' if self._vector_search_available else 'Not Available'}")
195192
return True
@@ -273,7 +270,7 @@ async def _connect_local(self) -> bool:
273270
self._is_atlas = False
274271
logger.info("📦 Standard MongoDB detected (no vector search)")
275272

276-
logger.info(f"✅ Local MongoDB connected successfully")
273+
logger.info("✅ Local MongoDB connected successfully")
277274
logger.info(f" Database: {self._config.db_name}")
278275
logger.info(f" Host: {self._config.host}:{self._config.port}")
279276
logger.info(f" Direct connection: {'directConnection=true' in uri}")
@@ -328,7 +325,7 @@ async def _check_vector_search_support(self) -> bool:
328325

329326
# Execute the pipeline
330327
cursor = collection.aggregate(test_pipeline, maxTimeMS=5000)
331-
results = await cursor.to_list(1)
328+
await cursor.to_list(1)
332329

333330
# If we get here without error, vector search is working!
334331
logger.info(f"✅ Vector search is WORKING with index '{index_name}'!")
@@ -410,7 +407,7 @@ async def _check_vector_search_support(self) -> bool:
410407
self._is_atlas = True
411408
return True
412409

413-
except:
410+
except Exception:
414411
pass
415412

416413
return False

0 commit comments

Comments
 (0)