FindMany
with nested relations
#21396
-
Bug descriptionI am trying to find multiple rows using nested relations, but it throws multiple errors This is the where clause I am trying: {
where: {
service: {
is: {
user: {
is: {
id: agentId,
}
}
}
},
},
} When I get rid of the How to reproduce
Expected behaviorIt should return a list of Prisma informationmodel users {
id Int @id @default(autoincrement())
Service Service[]
@@map("users")
}
model Service {
id Int @id @default(autoincrement())
userId Int
user users @relation(fields: [userId], references: [id])
ServicePlanning ServicePlanning[]
@@map("service")
}
model ServicePlanning {
id Int @id @default(autoincrement())
serviceId Int
service Service @relation(fields: [serviceId], references: [id])
@@map("service_planning")
}
enum ServiceAvailability {
available
unavailable
occupied
} prisma.servicePlanning.findMany({
where: {
service: {
is: {
user: {
is: {
id: agentId,
}
}
}
},
},
include: {
service: true,
},
}); Environment & setup
Prisma Version
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found the issue, it was that the value of |
Beta Was this translation helpful? Give feedback.
I found the issue, it was that the value of
agentId
was wrongly formatted to a string instead of a number, but then the error still does not make sense, the error should be type related and not a usability error