jstests/replsets/libs/tenant_migration_util.js
/**
     * Returns true if the given database role already exists.
     */
Returns true if the given database role already exists.
Returns true if the given database role already exists .
function roleExists(db, roleName) {
        const roles = db.getRoles({rolesInfo: 1, showPrivileges: false, showBuiltinRoles: false});
        const fullRoleName = `${db.getName()}.${roleName}`;
        for (let role of roles) {
            if (role._id == fullRoleName) {
                return true;
            }
        }
        return false;
    }
function roleExists ( db , roleName ) { const roles = db . getRoles ( { rolesInfo : 1 , showPrivileges : false , showBuiltinRoles : false } ) ; const fullRoleName = ` ${ db . getName ( ) } ${ roleName } ` ; for ( let role of roles ) { if ( role . _id == fullRoleName ) { return true ; } } return false ; }
Returns true if the given database role already exists.
Returns true if the given database role already exists .