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)],
},
},
});
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?
2 Replies
Angelelz
Angelelz4w ago
What happens when you run it? What’s the error?
Brokenwind
BrokenwindOP4w ago
Nothing happens (it doesn't sort) but I do get TypeScript errors: Object literal may only specify known properties, and 'orderBy' does not exist in type I've read in other places that this feature isn't available yet, tho I've seen it working in a drizzle.run site
Want results from more Discord servers?
Add your server