Aaron Waller
05/21/2022, 6:58 PMconst getActiveUsers = await prisma.user.findMany({
take: 10,
orderBy: {
posts: {
_count: 'desc',
},
},
})
This is not working for me, I only can choose the fields inside “orderBy” that are not arrays.
Am I missing something? Its a simple one-to-many relationAaron Waller
05/21/2022, 7:00 PMAvailable args:\n\ntype UserOrderByInput {\n uid?: SortOrder\n username?: SortOrder\n pictureURL?:
Here is my schema:
model User {
uid String @id @default(uuid())
username String? @db.VarChar(24) @unique
pictureURL String? @db.VarChar(255)
posts Posts[] @relation
}
Aaron Waller
05/22/2022, 3:58 AMNurul
05/24/2022, 12:21 PMgenerator client {
provider = "prisma-client-js"
previewFeatures = ["orderByRelation"]
}
If not, then it could be a reason for not working.