Checkbox Field

Checkboxes are for boolean values. Checkboxes default to NULL. Checking the value in the UI will return true, unchecking will return false - it is possible to nullify the result again using clear.

Sample Checkbox Query

Query

{
shops {
title
verified
}
}

Output

{
"data": {
"shops": [
{
"title": "Happy Valley Coffee",
"verified": true
},
{
"title": "Happy Mountain Tea",
"verified": false
}
]
}
}

Filtering by Checkbox

Checkbox filters support:

  • verified
  • verified_not

verified: Boolean

{
shops(where: { verified: true }) {
title
verified
}
}

verified_not: Boolean

{
shops(where: { verified_not: true }) {
title
verified
}
}

Mutating a Checkbox

mutation {
createShop(data: { title: "Route 66 Coffee Stop", verified: true }) {
title
verified
}
}

Output

{
"data": {
"createShop": {
"title": "Route 66 Coffee Stop",
"verified": true
}
}
}

This site uses cookies to provide you with a better user experience. For more information, refer to our Privacy Policy