Unable to sort relational query

The docs says this should work:

await db.query.posts.findMany({
    orderBy: (posts, { asc }) => [asc(posts.id)],
    with: {
        comments: {
            orderBy: (comments, { desc }) => [desc(comments.id)],
        },
    },
});


But for some reason, this doesn't work out on my end. Is this still a bug or there's a workaround for this?
Was this page helpful?