Skip to content

Commit

Permalink
Docs (GraphQL): Add documentation for has filter on list of fields
Browse files Browse the repository at this point in the history
  • Loading branch information
selectiveduplicate committed Mar 22, 2021
1 parent c9d4fac commit ef15159
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion content/graphql/queries/search-filtering.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,14 @@ field using the `has` keyword. The `has` keyword can only check whether a field
returns a non-null value, not for specific field values.

For example, your schema might define a `Student` type that has basic
information about each student; such as their ID number, age, and name:
information about each student; such as their ID number, age, name, and email address:

```graphql
type Student {
tid: ID!
age: Int!
name: String
email: String
}
```

Expand All @@ -273,3 +274,15 @@ queryStudent(filter: { has : name } ){
name
}
```
You can also specify a list of fields, like the following:

```graphql
queryStudent(filter: { has : [name, email] } ){
tid
age
name
email
}
```

This would return `Student` objects where both `name` and `email` fields are non-null.

0 comments on commit ef15159

Please sign in to comment.