I don't think the AND option works if you send an object. It typically takes an array of objects (https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#examples-46).
The simpler way to do the query is to leave out the AND entirely:
await prisma.user.findMany({
where: {
user_id: {
in: users.map(user => user.user_id)
},
school_id: {
in: users.map(user => user.school_id)
}
}
})
This is essentially an 'implicit' AND.
Nested Filtering in Prisma
`whereRaw` model query option for Prisma Client queries
Type error in `IN` clause in postgreSQL using `$queryRaw` when upgrading to v4
Subqueries in Prisma, Many-Many relation
I heard a lot of praise about Prisma and a decent number of "complaints" towards it. I would like to,
-
Understand the good and the bad about it, compared to other ORMs.
-
I'm trying to get my hands on BE development and am looking for the most widely used ORM to start learning (mostly for better career). If you believe Prisma is not the one, which one would you suggest?
p.s. previously also tried NestJS + TypeORM. And I used to be a DBA so I know DB a thing or two, in case these matters.