1
// SERVER-8625: Test that dbAdmins can view index definitions.
2
var conn = MongoRunner.runMongod({auth : ""});
4
var adminDB = conn.getDB("admin");
5
var testDB = conn.getDB("testdb");
7
testDB.foo.insert({a:1});
9
testDB.addUser({user:'dbAdmin',
13
adminDB.addUser({user:'admin',
15
roles:['userAdminAnyDatabase']}); // To disable localhost auth bypass
17
testDB.auth('dbAdmin', 'password');
18
testDB.foo.ensureIndex({a:1});
19
assert.eq(4, testDB.system.indexes.count()); // 2 for system.users, 2 for foo
20
var indexDoc = testDB.system.indexes.findOne({key:{a:1}});
22
assert.neq(null, indexDoc);
23
assert.eq(4, testDB.system.indexes.stats().count);
b'\\ No newline at end of file'