limit may limit the number of posts:
conversations.merge(conversation => {
messages: conversation('messages').limit(3)
})
orderBy can be used to sort an array:
conversations.merge(conversation => {
messages: conversation('messages').orderBy('createdAt')
})
If you sort messages by each query, it may be more efficient to store an already sorted list of messages.
Atnnn source
share