hi guys not sure why im getting this playground er...
# orm-help
i
hi guys not sure why im getting this playground error https://www.screencast.com/t/oxJZmgDH
l
can i check your schema.graphql
i
I am sure its some silly syntax error but cannot figure it out
j
i can't see, but is it in a
where
object?
h
You need to use where
{items(where: { title: "title"}){title}}
j
Copy code
query allItems {
  items(
    where: {
       title: "test2"
     }
  ) {
    id
    title

  }
i
I thought I needed to use where but then that gives me :
Unknown argument \"where\" on field \"items\" of type \"Query\"."
The first way at least gives me the correct result but still underlines an error for some reason
h
It should work, from first look can you expand schema on right and show how looks your query?
l
your schema.graphql need to be ==> allItems(title: String!): [Item]!
👍 1
i
@lucas Damnnnn thats amazing that it fixed it
why would making it required fix that error
l
niceeee 🙂 ok so if you need to query something by using argument as "title" or something else you have in the fields of items you put it as argument in your type Query in schema.graphql i recommend to use forwardTo('prisma') and you'll have access to all the arguments prisma have its really powerfull !
forwardTo('prisma') needs to be use in resolvers only
j
+1 for
forwardTo("db")
👍 1
i
Hmm right but I had everything the same except the exclmation point, and The exclamation mark in the type definition means that this field can never be
null
so Im trying to see why that caused the error in playground
l
ah ok so it means it will return an empty array if it cant find the query but it needs to return an empty array
the query needs to return something so thats why we put an exclam
after the array
i
But we added it to
String!
which was the only difference
it was already there in
[Item]!
l
allItems(title: String): [Item]!
should work as well
without argument and with argument
i
Right, thats strange then maybe it was some glitch in playground because literally nothing else but that changed lol Regardless, thank you (and everyone else) for helping me fix it 🙂
l
ur welcome 🙂 yes sometimes after a change we need to refresh the playground page if not there are some errors
👍 1
h
maybe you didn't update schema in playground
i
I did , I refreshed it also thats why its strange the error is gone. I am using the Electron App though , so maybe it was some glitch lol
what I do wonder @huv1k is why this syntax that you suggested
{items(where: { title: "title"}){title}}
never worked for me, but the way I am doing it now without the
where
word in my Query does work... I do have the
where
in my resolver
To me it seems like that syntax looks more correct with the
where
in the query
h
I didn't know what is your application schema 🙂 so i just used normal schema what is called to prisma with your bindings
if you open your prisma endpoint you can try it 🙂