0
我想使用sequelize & nodeJS在我們的postgresql數據庫上進行查詢。Sequelize嵌套數據結構
除了模型深層嵌套關係的結構之外,這一切都工作正常。
我的例子:
{
model: this.Parent,
as: 'Parent',
include: [
{
model: this.Child,
as: 'child',
include: [
{
model: this.nestedChild,
as: 'nestedChild',
},
],
},
],
},
爲孩子和nestedChild在「包括」對象返回的數據,問題是,nestedChild不再是「關係」的對象的孩子,而不是它的其中一個參數。 例如:
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
}
]