jstests/auth/builtin_roles_system_colls.js
// collstats command on all resouces, including system resources.
collstats command on all resouces, including system resources.
collstats command on all resouces including system resources .
function testBackupSystemCollStats(adminDB) {
    adminDB.auth("root", "pwd");
    adminDB.createUser({ user: "backup-agent", pwd: "pwd", roles: ["backup"] });
    adminDB.system.js.save({ _id: "testFunction", value: function (x){ return x; }});
    adminDB.logout();
    adminDB.auth("backup-agent", "pwd");
    assert.commandWorked(adminDB.runCommand({ collstats: "system.users" }));
    assert.commandWorked(adminDB.runCommand({ collstats: "system.roles" }));
    assert.commandWorked(adminDB.runCommand({ collstats: "system.js" }));
    adminDB.logout();
}
function testBackupSystemCollStats ( adminDB ) { adminDB . auth ( "root" , "pwd" ) ; adminDB . createUser ( { user : "backup-agent" , pwd : "pwd" , roles : [ "backup" ] } ) ; adminDB . system . js . save ( { _id : "testFunction" , value : function ( x ) { return x ; } } ) ; adminDB . logout ( ) ; adminDB . auth ( "backup-agent" , "pwd" ) ; assert . commandWorked ( adminDB . runCommand ( { collstats : "system.users" } ) ) ; assert . commandWorked ( adminDB . runCommand ( { collstats : "system.roles" } ) ) ; assert . commandWorked ( adminDB . runCommand ( { collstats : "system.js" } ) ) ; adminDB . logout ( ) ; }
collstats command on all resouces, including system resources.
collstats command on all resouces including system resources .