How does one implement Prisma's features like count relations and nested reads?

Thank you so much for the comprehensive answer! I will definitely be using raw sql to build out a custom field and will come back to your examples to guide me :slight_smile:

I suddenly realized that I could use JSON as a type and added that to the SDL to access the count relations result

// api/src/post.sdl.js

 type Post {
    id: Int!
    [...]
   _count: JSON
  }

With the code I posted earlier, I was able to access the count in the cell query!

1 Like