1
這不使用order
,我不知道爲什麼我不能用order
根表作爲posts
模式?當我使用這下面的代碼我得到這個錯誤:Sequelize訂單時,我們使用下面一起工作<code>Sequelize</code>罰款,我的方法
Unhandled rejection Error: 'posts' in order/group clause is not valid association
但在其他車型如channelVideoContainer
models.posts.findAll({
where: {
channelId: 1
},
include: [
{
model: models.channelVideoContainer,
include: [models.fileServerSetting]
}, {
model: models.channelMusicContainer,
include: [models.fileServerSetting]
}, {
model: models.channelImageWithTextContainer,
include: [models.fileServerSetting]
}, {
model: models.channelFilesContainer,
include: [models.fileServerSetting]
},
models.channelPlainTextContainer
], order: [
[{model: models.posts}, 'id', 'DESC'],
], limit: 5
}).then(function (result) {
console.log(JSON.stringify(result));
});
什麼領域是你特林通過訂購? 'id'?在這種情況下,我覺得應該是'命令:[「posts.id」,「DESC」]' –
什麼型號的關係定義是什麼? – doublesharp
@miparnisari我得到這個錯誤:'ER_BAD_FIELD_ERROR:在「爲了未知列「DESC」 clause'' –