diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 51ac8104ca..877f8d40fa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -29,7 +29,7 @@ Changed Contributed by @ericreeves. -* update db connect mongo connection test - `isMaster` MongoDB command depreciated, switch to `hello` #5302 +* update db connect mongo connection test - `isMaster` MongoDB command depreciated, switch to `ping` #5302, #5341 Contributed by @lukepatrick diff --git a/st2common/st2common/models/db/__init__.py b/st2common/st2common/models/db/__init__.py index fe21aa0a6b..5e25bf4a19 100644 --- a/st2common/st2common/models/db/__init__.py +++ b/st2common/st2common/models/db/__init__.py @@ -199,9 +199,9 @@ def _db_connect( # successfully established. # See http://api.mongodb.com/python/current/api/pymongo/mongo_client.html for details try: - # The hello command is cheap and does not require auth - # https://docs.mongodb.com/v4.4/reference/command/hello/ - connection.admin.command("hello") + # The ping command is cheap and does not require auth + # https://www.mongodb.com/community/forums/t/how-to-use-the-new-hello-interface-for-availability/116748/ + connection.admin.command("ping") 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