【发布时间】:2018-04-17 20:01:48
【问题描述】:
我的错误,问题不完整,将所有缺失的文本标记为粗体
我有以下型号:
- 病人
- 个人
- 地址
- 患者地址
- PatientAddress.belongsTo(患者);
- Patient.belongsTo(Personal);
- PatientAddress.belongsTo(Address);
我正在尝试读取患者并想读取地址,如下所示:
患者 => 患者地址 => 地址
我还需要阅读 Personal model with Patient
我可以使用 include 读取 PatientAddress, Personal,但无法读取 Address。我试过这些:
return Patient.findAll({
limit: limit,
offset: offset,
include: [{
model: [Personal, PatientAddress],
include: [{
Address
}]
}]
});
return Patient.findAll({
limit: limit,
offset: offset,
include: [{
model: [Personal, PatientAddress],
include: [{
PatientAddress.Address
}]
}]
});
或
return Patient.findAll({
limit: limit,
offset: offset,
include: [Personal, PatientAddress, PatientAddress.Address]
});
要改变什么?
【问题讨论】:
标签: node.js sequelize.js