summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2019-01-14 22:45:00 +0000
committerSara Golemon <sara.golemon@mongodb.com>2019-01-18 17:55:15 +0000
commit116a97a5dac8ebf8784b15ff09569afd9032cdc6 (patch)
tree1974941c741e5e9f6fca6b544d4369703830f2de /jstests
parent9dafb7a3e3bafa463ab5951189b670965995dada (diff)
downloadmongo-116a97a5dac8ebf8784b15ff09569afd9032cdc6.tar.gz
SERVER-38887 Return names encapsulated when falling back on privilege inspection
Diffstat (limited to 'jstests')
-rw-r--r--jstests/auth/list_databases.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/jstests/auth/list_databases.js b/jstests/auth/list_databases.js
index 9bac4b68387..a69472fb77f 100644
--- a/jstests/auth/list_databases.js
+++ b/jstests/auth/list_databases.js
@@ -74,6 +74,8 @@
// Ignore these for simplicity.
return (db !== 'local') && (db !== 'config');
}
+
+ // Invoking {listDatabases: 1} directly.
function tryList(cmd, expect_dbs) {
const dbs = assert.commandWorked(admin.runCommand(cmd));
assert.eq(dbs.databases
@@ -125,8 +127,12 @@
return adminCommandMethod(cmd);
};
// Command fails, but we dispatch via _getDatabaseNamesFromPrivileges().
- assert.eq(mongod.getDBs(), test.authDbs || test.dbs);
- // Still dispatches with explciti nameOnly===true.
+ assert.eq(mongod.getDBs().databases.map(function(x) {
+ return x.name;
+ }),
+ test.authDbs || test.dbs);
+
+ // Still dispatches with explicit nameOnly===true, returns only names.
assert.eq(mongod.getDBs(undefined, undefined, true), test.authDbs || test.dbs);
// Command fails and unable to dispatch because nameOnly !== true.