summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2019-03-07 11:50:13 -0500
committerMathias Stearn <mathias@10gen.com>2019-03-11 14:58:21 -0400
commitef5c6c6f837cc317bd048db29948ca387517ef25 (patch)
tree2145d43afe7602b5cd5672c4d1645c68ff99b421 /src/mongo/shell
parent33188722f723293fdbe0c8a273500e8cf293a021 (diff)
downloadmongo-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.js11
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) {