PrismaP
Prisma2y ago
2 replies
Emi

Prisma filter variable in given array

I have an array position:["GK","CDM","CF"]
and I have a
model Player {
id Int @id @default(autoincrement())
name String
age Int?
position String?
}
I need to filter position field if it has any of the given positions in position array.
How should I do that?

I tried this way but it doesn't work
 position:
        parsedFilters.positions && parsedFilters.positions.length > 0
          ? {
              position: {
                in: parsedFilters.positions,
              },
            }
          : null,
Was this page helpful?