How would I query the type below to find the Perso...
# orm-help
j
How would I query the type below to find the Person that has a matching email?
Copy code
type Person @model {
  id : ID! @isUnique
  emailAddresses: [String!]! @isUnique
}
For some reason I'm unable to query the emailAddresses because they're lists? It's not even a filter option?
l
Use
persons
function under
type Query
on
prisma.graphql
file. You will be able to filter them through 'where' parameter. (If you follow 'PersonWhereInput', you will be able to find directions on how to filter
emailAddresses
.)
j
Hmmm, I'm using GraphCool Console, is that possible in the Console? Do I need to eject?
n
in Graphcool, the query is
query { Person(id: "abc") { id } }
j
Thank you, but is it possible to do something like this?
Copy code
query { Person( emailAddress: "<mailto:abc@xyz.com|abc@xyz.com>" ) { id } }
I'd like to query by emailAddress. Is that possible?
n
yes, if the field is marked as unique in your data model 🙂