Complete the code to define a GraphQL query that fetches a user's name.
query GetUserName { user(id: 1) { [1] } }The field name correctly fetches the user's name in the query.
Complete the code to add a nested field to fetch the user's posts titles.
query GetUserPosts { user(id: 1) { name posts { [1] } } }content instead of title when only titles are needed.comments.The title field fetches the titles of the user's posts.
Fix the error in the query by selecting the correct field to limit the number of posts fetched.
query GetLimitedPosts { user(id: 1) { posts([1]: 5) { title } } }count or max which are not valid argument names here.size which is not recognized by the schema.The limit argument is commonly used to restrict the number of items returned.
Fill both blanks to create a query that fetches users with their posts filtered by a minimum number of likes.
query GetPopularPosts { users { name posts(filter: { likes: { [1]: [2] } }) { title } } }lt when filtering for popular posts.The filter uses likes: { gt: 10 } to get posts with more than 10 likes.
Fill all three blanks to write a query that fetches posts with title, author name, and comments count greater than 5.
query GetDetailedPosts { posts(filter: { comments: { [1]: [2] } }) { [3] author { name } } }content instead of title when only the title is requested.lt in the filter.The query filters posts with comments: { gt: 5 } and fetches the title and author's name.