Prisma filter field in array
Unanswered
Prairie yellowjacket posted this in #help-forum
Prairie yellowjacketOP
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,
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,