|
8 | 8 | import os |
9 | 9 | import logging |
10 | 10 | from dataclasses import dataclass |
11 | | -from typing import Optional, Dict, Any, List, Union |
| 11 | +from typing import Optional, Dict, Any, List |
12 | 12 | from datetime import datetime |
13 | 13 | import asyncio |
14 | 14 |
|
|
19 | 19 | ) |
20 | 20 | from pymongo.errors import ( |
21 | 21 | ConnectionFailure, |
22 | | - ServerSelectionTimeoutError, |
23 | | - OperationFailure, |
24 | | - ConfigurationError |
| 22 | + OperationFailure |
25 | 23 | ) |
26 | 24 | from pymongo import ASCENDING, TEXT |
27 | | -from bson import ObjectId |
28 | 25 |
|
29 | 26 | logger = logging.getLogger(__name__) |
30 | 27 |
|
@@ -189,7 +186,7 @@ async def _connect_atlas(self) -> bool: |
189 | 186 | self._connected = True |
190 | 187 | self._is_atlas = True |
191 | 188 |
|
192 | | - logger.info(f"✅ MongoDB Atlas connected successfully") |
| 189 | + logger.info("✅ MongoDB Atlas connected successfully") |
193 | 190 | logger.info(f" Database: {self._config.db_name}") |
194 | 191 | logger.info(f" Vector Search: {'Available' if self._vector_search_available else 'Not Available'}") |
195 | 192 | return True |
@@ -273,7 +270,7 @@ async def _connect_local(self) -> bool: |
273 | 270 | self._is_atlas = False |
274 | 271 | logger.info("📦 Standard MongoDB detected (no vector search)") |
275 | 272 |
|
276 | | - logger.info(f"✅ Local MongoDB connected successfully") |
| 273 | + logger.info("✅ Local MongoDB connected successfully") |
277 | 274 | logger.info(f" Database: {self._config.db_name}") |
278 | 275 | logger.info(f" Host: {self._config.host}:{self._config.port}") |
279 | 276 | logger.info(f" Direct connection: {'directConnection=true' in uri}") |
@@ -328,7 +325,7 @@ async def _check_vector_search_support(self) -> bool: |
328 | 325 |
|
329 | 326 | # Execute the pipeline |
330 | 327 | cursor = collection.aggregate(test_pipeline, maxTimeMS=5000) |
331 | | - results = await cursor.to_list(1) |
| 328 | + await cursor.to_list(1) |
332 | 329 |
|
333 | 330 | # If we get here without error, vector search is working! |
334 | 331 | logger.info(f"✅ Vector search is WORKING with index '{index_name}'!") |
@@ -410,7 +407,7 @@ async def _check_vector_search_support(self) -> bool: |
410 | 407 | self._is_atlas = True |
411 | 408 | return True |
412 | 409 |
|
413 | | - except: |
| 410 | + except Exception: |
414 | 411 | pass |
415 | 412 |
|
416 | 413 | return False |
|
0 commit comments