Javascript 使用“创建元素”;“有很多”;联想不起作用

Javascript 使用“创建元素”;“有很多”;联想不起作用,javascript,node.js,sequelize.js,Javascript,Node.js,Sequelize.js,我有两种型号: 角色 烫发 我正在尝试使用他的权限创建大量角色: 这创建了角色,但当我执行以下操作时,角色没有权限: models.auth.roles.findAll() .then(function (roles) { roles[4].getPerms().then(function (perms) { console.log("pn:", roles[4].name);

我有两种型号:

  • 角色
  • 烫发
我正在尝试使用他的权限创建大量角色:

这创建了角色,但当我执行以下操作时,角色没有权限:

        models.auth.roles.findAll()
            .then(function (roles) {

                roles[4].getPerms().then(function (perms) {
                    console.log("pn:", roles[4].name);
                    console.log("P", perms.length );
                });

                console.log("Roles", roles.length);
            }).catch(cb);
getPerms()不返回任何结果(我尝试了各种角色实例)

我做错了什么

对不起,我的英语很差

        models.auth.roles.findAll()
            .then(function (roles) {

                roles[4].getPerms().then(function (perms) {
                    console.log("pn:", roles[4].name);
                    console.log("P", perms.length );
                });

                console.log("Roles", roles.length);
            }).catch(cb);