Challenge - 5 Problems
Filtering Arguments Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
Filtering users by age greater than 30
Given the following GraphQL query, what is the expected output if the database contains users with ages 25, 35, and 40?
GraphQL
query {
users(age_gt: 30) {
id
name
age
}
}Attempts:
2 left
💡 Hint
Think about which users have age greater than 30.
✗ Incorrect
The filter age_gt: 30 returns only users whose age is greater than 30, so users aged 35 and 40 are included.
📝 Syntax
intermediate2:00remaining
Identify the syntax error in filtering by name
Which option contains a syntax error in this GraphQL query filtering users by name?
GraphQL
query {
users(name_eq: "John") {
id
name
}
}Attempts:
2 left
💡 Hint
Check if string values are properly quoted.
✗ Incorrect
In GraphQL, string arguments must be enclosed in double quotes. Option A misses quotes around John, causing a syntax error.
❓ optimization
advanced2:00remaining
Optimizing filtering with multiple arguments
Which query is the most efficient to filter users by age greater than 20 and name starting with 'A'?
Attempts:
2 left
💡 Hint
Filtering on the server reduces data transfer and processing.
✗ Incorrect
Applying both filters in the query reduces the amount of data sent and processed, making it more efficient.
🧠 Conceptual
advanced2:00remaining
Understanding filtering argument types
Which filtering argument type allows selecting records where a field value is within a list of values?
Attempts:
2 left
💡 Hint
Think about selecting multiple possible values for a field.
✗ Incorrect
The 'in' argument filters records where the field matches any value in a given list.
🔧 Debug
expert2:00remaining
Debugging a filter that returns no results
A query filters users with age_lt: 18 but returns no results, even though the database has users aged 16 and 17. Which option explains the most likely cause?
GraphQL
query {
users(age_lt: 18) {
id
name
age
}
}Attempts:
2 left
💡 Hint
Check if the filtering argument is defined in the schema.
✗ Incorrect
If the schema does not support 'age_lt', the filter is ignored and no filtering happens, possibly returning no results.