Hey, curious how can I construct a query to fetch ...
# orm-help
m
Hey, curious how can I construct a query to fetch tag which has the most contents (relations)? Eg.
Copy code
Tag {
    contents    Content[]
    name        String      @unique
}
Would need to order tag which has most content first.
Got it
Copy code
const popularTags = await prisma.tag.findMany({
  orderBy: {
    contents: {
      count: 'desc',
    },
  },
})