我试图通过belongsToMany
关系订购。我想按firstName
表的Subscriptions
列进行排序,该表与event.getSubscriptions()查询一起返回。我现在就在这里:
return event.getSubscriptions({
where: {
id: {
$ne: event.currentUserId
}
},
order: // I would like to order by the Subscription.firstName column
})
我该怎么做呢?
提前致谢!
答案 0 :(得分:3)
你可以这样做
return event.getSubscriptions({
where: {
id: {
$ne: event.currentUserId
}
},
order: 'firstName'
})
仅降序变更顺序:' firstName DESC'