'mongo shell option socket time out

use mongo shell with ldap authentication but stuck because some of the server is not working. mongo shell take long time (15 min) to timeout. any way to set socket timeout in mongo shell ? I want mongo shell to timeout after x second instead wait for long time

connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName =mongodb 2022-03-29T20:29:19.962-0500 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:341:17

try connect mongo shell and some of the server hit socketexception issue but it took long time to terminated the connection. sockettimeout might related to ldap authentication. use mongo internal account not face this issue



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source