diff options
author | Mathias Stearn <mathias@10gen.com> | 2019-03-07 11:50:13 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2019-03-11 14:58:21 -0400 |
commit | ef5c6c6f837cc317bd048db29948ca387517ef25 (patch) | |
tree | 2145d43afe7602b5cd5672c4d1645c68ff99b421 /src/mongo/shell | |
parent | 33188722f723293fdbe0c8a273500e8cf293a021 (diff) | |
download | mongo-ef5c6c6f837cc317bd048db29948ca387517ef25.tar.gz |
SERVER-38625 When the shell fails to connect to an Atlas cluster, tell the user to check their IP whitelist
Diffstat (limited to 'src/mongo/shell')
-rw-r--r-- | src/mongo/shell/mongo.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/shell/mongo.js b/src/mongo/shell/mongo.js index 2f25605536d..b3ec12e19bc 100644 --- a/src/mongo/shell/mongo.js +++ b/src/mongo/shell/mongo.js @@ -343,7 +343,16 @@ connect = function(url, user, pass) { safeURL = url.substring(0, protocolPos + 3) + url.substring(atPos + 1); } chatty("connecting to: " + safeURL); - var m = new Mongo(url); + try { + var m = new Mongo(url); + } catch (e) { + if (url.indexOf(".mongodb.net") != -1) { + print("\n\n*** It looks like this is a MongoDB Atlas cluster. Please ensure that your" + + " IP whitelist allows connections from your network.\n\n"); + } + + throw e; + } var db = m.getDB(m.defaultDB); if (user && pass) { |