Implemented default pipeline
This commit is contained in:
@@ -7,6 +7,7 @@ The application will terminate if MongoDB is not accessible at startup.
|
||||
|
||||
import sys
|
||||
from typing import Optional
|
||||
|
||||
from pymongo import MongoClient
|
||||
from pymongo.database import Database
|
||||
from pymongo.errors import ConnectionFailure, ServerSelectionTimeoutError
|
||||
@@ -107,6 +108,15 @@ def get_mongodb_client() -> Optional[MongoClient]:
|
||||
return _client
|
||||
|
||||
|
||||
def get_extra_args(session):
|
||||
# Build kwargs only if session is provided
|
||||
kwargs = {}
|
||||
if session is not None:
|
||||
kwargs["session"] = session
|
||||
|
||||
return kwargs
|
||||
|
||||
|
||||
def test_database_connection() -> bool:
|
||||
"""
|
||||
Test if database connection is working.
|
||||
@@ -122,4 +132,4 @@ def test_database_connection() -> bool:
|
||||
db.command('ping')
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user