I'm trying to order by on a belongsToMany
relationship. I would like to order by the column firstName
of the Subscriptions
table, which is returned with the event.getSubscriptions() query. Here's where I'm at right now:
return event.getSubscriptions({
where: {
id: {
$ne: event.currentUserId
}
},
order: // I would like to order by the Subscription.firstName column
})
How can I go about doing this?
Thanks in advance!
You can do like this
return event.getSubscriptions({
where: {
id: {
$ne: event.currentUserId
}
},
order: 'firstName'
})
for descending just change order : 'firstName DESC'