In this video Emmanuel Henri demonstrates how to do a query with an argument and resolve the query with the Mongo database.
- [Lecturer] Before we start this video…you need to add a new item…with a firm mutation.…Just like we did in a previous video.…As I mentioned previously…I had one for testing.…So you'll want to add that…before moving on with this video.…Doing a query with an argument…is as easy as passing input…into a mutation like we've done in our code thus far.…Let me demonstrate.…So the first thing we need to do is…go into our schema again.…If you don't have it open,…just go into schema.js and then open it…and then what we'll do is change this here.…
So we'll change it to…getOneFriend…and we'll pass an id…and we absolutely need an id…so we need an exclamation point here.…And then we'll return a friend.…And let's make sure it's a capital F…like so.…So we've done a few of these with arguments.…So if you take a look at all the mutations…that we've done with arguments…it's pretty much the same thing.…So we're passing an idea here…and we'll return a single Friend…so let's save that…and all we need to do at this point…is change our resolver.…
- Basic GraphQL schema
- Object types and fields
- Role of the resolver in GraphQL
- Scalar and enumeration types
- Using GraphQL tools
- Setting up persistence
- Adding new items with mutations
- Updating and deleting items with mutations
- Queries with arguments, aliases, and fragments
Skill Level Intermediate
1. Setup and Introduction
2. Types and Schemas
3. Setting Up Persistence
5. Queries in Depth
Next steps1m 8s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.