menu

Prisma

🔴 The Prisma Spectrum community is not officially managed by Prisma's support team any more. Please seek help on GitHub or on Slack instead. Learn more: https://spectrum.chat/prisma/general/where-and-how-to-best-seek-help-with-questions-problems~687a1b8f-8658-4df3-8849-ea5ab3503f28

Channels
Chat
view-forward
# All channels
view-forward
# General
view-forward
# Beta
view-forward
# Community
view-forward
# GraphQL
view-forward
# OSS
view-forward
# Random
view-forward
Team

Help with arrays as variables

January 15, 2020 at 7:38pm

Help with arrays as variables

January 15, 2020 at 7:38pm (Edited 7 months ago)
So I have the following working GQL:
mutation updateManySomething{
updateManySomething(
data: {
dateTime: "2020-01-15T13:07:42-06:00"
status: true
updatedBy: "1234"
}
where: { id_in: ["1234", "1234" ] }
) {
count
}
}
However when I try and make it accept passed variables it craps out because there is no ID! defined because it's an array of IDs....
mutation updateManySomething(
$id: ID!
$dateTime: DateTime
$status: Boolean
$updatedBy: String!
) {
updateManySomething(
data: {
dateTime: $dateTime
status: $status
updatedBy: $updatedBy
}
where: { id_in: [$id] }
) {
count
}
}
I have tried skipping the $id: ID! and creating a new variable $arrayOfIds: Json but that fails as well, anyone have any idea what I can do? The backend is prisma JS is running in React-Native.
No messages yet