diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c5421460ef..ea75d758f1 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,6 +20,10 @@ Changed Contributed by @ericreeves. +* update db connect mongo connection test - `isMaster` MongoDB command depreciated, switch to `hello` #5302 + + Contributed by @lukepatrick + 3.5.0 - June 23, 2021 --------------------- diff --git a/st2common/st2common/models/db/__init__.py b/st2common/st2common/models/db/__init__.py index 9ed99c7c91..fe21aa0a6b 100644 --- a/st2common/st2common/models/db/__init__.py +++ b/st2common/st2common/models/db/__init__.py @@ -199,8 +199,9 @@ def _db_connect( # successfully established. # See http://api.mongodb.com/python/current/api/pymongo/mongo_client.html for details try: - # The ismaster command is cheap and does not require auth - connection.admin.command("ismaster") + # The hello command is cheap and does not require auth + # https://docs.mongodb.com/v4.4/reference/command/hello/ + connection.admin.command("hello") except (ConnectionFailure, ServerSelectionTimeoutError) as e: # NOTE: ServerSelectionTimeoutError can also be thrown if SSLHandShake fails in the server # Sadly the client doesn't include more information about the error so in such scenarios