【发布时间】:2018-03-16 04:18:32
【问题描述】:
我正在尝试使用 sequelize 和 nodeJS 对我们的 postgresQL 数据库进行查询。
除了模型的深层嵌套关系结构之外,一切都很好。
我的例子:
{
model: this.Parent,
as: 'Parent',
include: [
{
model: this.Child,
as: 'child',
include: [
{
model: this.nestedChild,
as: 'nestedChild',
},
],
},
],
},
child 和nestedChild 的数据在'included' 对象中返回,问题是nestedChild 不再在child 的'relationships' 对象中,而是它的参数之一。 示例:
data: [proper array of Parent elements with defined 'child' relationship in 'relationships' object],
included: [
{
attributes: {
nested-child: {
(here are properties for my nestedChild)
}
},
relationships: <------ this is missing, and should include my nestedChild
}
]
【问题讨论】:
标签: node.js postgresql orm sequelize.js