summaryrefslogtreecommitdiff
path: root/src/mongo/shell/utils.js
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2019-07-21 17:20:33 -0400
committerAndrew Morrow <acm@mongodb.com>2019-07-23 18:13:12 -0400
commit0789a935ccee8e402cce8c7cdf52a41b9cc17010 (patch)
tree970e19bfc1db300d0d94c64c0d1ffc58cc7a71ae /src/mongo/shell/utils.js
parentb94251e25f11342530265e0ff0c7b8b91122a9c1 (diff)
downloadmongo-0789a935ccee8e402cce8c7cdf52a41b9cc17010.tar.gz
SERVER-42257 Announce known emulations
Diffstat (limited to 'src/mongo/shell/utils.js')
-rw-r--r--src/mongo/shell/utils.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js
index ce840fc5c0f..11e6cde6902 100644
--- a/src/mongo/shell/utils.js
+++ b/src/mongo/shell/utils.js
@@ -1091,6 +1091,51 @@ shellHelper.show = function(what) {
}
}
+ if (what == "nonGenuineMongoDBCheck") {
+ let matchesKnownImposterSignature = false;
+
+ // A MongoDB emulation service offered by a company
+ // responsible for a certain disk operating system.
+ try {
+ const buildInfo = db.runCommand({buildInfo: 1});
+ if (buildInfo.hasOwnProperty('_t')) {
+ matchesKnownImposterSignature = true;
+ }
+ } catch (e) {
+ // Don't do anything here. Just throw the error away.
+ }
+
+ // A MongoDB emulation service offered by a company named
+ // after some sort of minor river or something.
+ if (!matchesKnownImposterSignature) {
+ try {
+ const cmdLineOpts = db.adminCommand({getCmdLineOpts: 1});
+ if (cmdLineOpts.hasOwnProperty('errmsg') &&
+ cmdLineOpts.errmsg.indexOf('not supported') !== -1) {
+ matchesKnownImposterSignature = true;
+ }
+ } catch (e) {
+ // Don't do anything here. Just throw the error away.
+ }
+ }
+
+ if (matchesKnownImposterSignature) {
+ print("\n" + "Warning: Non-Genuine MongoDB Detected\n\n" +
+
+ "This server or service appears to be an emulation of MongoDB " +
+ "rather than an official MongoDB product.\n\n" +
+
+ "Some documented MongoDB features may work differently, " +
+ "be entirely missing or incomplete, " +
+ "or have unexpected performance characteristics.\n\n" +
+
+ "To learn more please visit: " +
+ "https://dochub.mongodb.org/core/non-genuine-mongodb-server-warning.\n");
+ }
+
+ return "";
+ }
+
throw Error("don't know how to show [" + what + "]");
};