sequelize-typescript 获取子查询的属性
2019-02-25 本文已影响0人
AsaGuo
- 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)
});
- 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);
});