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'' –