美文网首页
sequelize-typescript 获取子查询的属性

sequelize-typescript 获取子查询的属性

作者: AsaGuo | 来源:发表于2019-02-25 13:56 被阅读0次
    1. raw:true
        book.findAndCountAll({
            attributes:['book.*','person.name'],
            raw:true,
            include:[{
                model:person,
                attributes:['name'],
            }]
        }).then(results => {
            console.log("results.rows[0].name:",results.rows[0].name)
        });
    
    1. raw:false
        book.findAndCountAll({
            attributes:['book.*','person.name'],
            include:[{
                model:person,
                attributes:['name'],
            }]
        }).then(results => {
            console.log("results.rows[0].person.name:",results.rows[0].person.name);
        });
    

    相关文章

      网友评论

          本文标题:sequelize-typescript 获取子查询的属性

          本文链接:https://www.haomeiwen.com/subject/hiawyqtx.html