How to do sorting / ordering / orderBy:not working?

I’m still at the beginning of learning Primsa/GraphQL and how they relate to each other.

I can’t seem to figure out how to do a simple sort. explains that posts(orderBy:id_ASC) should be supported. But also seems to be outdated Prisma 1 documentation. I can’t find anything on ordering/sorting in the new docs.

In the Playground i get

Unknown argument “orderBy” on field “posts” of type “Query”."

In the /services/posts/posts.js I can’t figure out a proper syntax, something like:

return{ orderBy: {createdAt: ASC} })

With graphql I only find explanations that involve manipulation the resolver. I’m not sure that’s what I have to do in RedwoodJS. Where would I need to go to manipulate it. /services?

Figured out the correct syntax:


return{ orderBy: {id: 'desc'} })

Source: Prisma Docs findMany

1 Like