Okay, did everyone get this first query, which is find the titles of the first 10 movies ordered by title? Well, we can look in the docs to see that we have the movies entry points. So we'll start there. So movies, and then we can see with the control space, the different fields available. And that's the title, we know we want that. But we know we want just the first 10. So if I look in the docs, I can see for the movies query field, there's a couple of arguments, which I need to explain more down here. So there's a where argument, which has things like filtering functionality it looks like, so that's not quite what we need in options though. We have sorting and limiting. So I think that's what we want. So let's add an options field argument here. You wanna limit, what did they say? First 10 movies. Let's test this, that gives us 10 movies, but we want these to be sorted by title. So let's add sorting, and then we need to specify a sort direction. And so in this API, we can start by title, then ascending or descending order. And if we do that in ascending order, we can see here, got some special characters that start first. So here's our first 10 movies ordered by title. Cool.
Anyone get this next question, which is, who acted in the movie, Jurassic Park? Did anyone get that one? Well, let's take a look. So we saw previously, that movies has a where argument. And if we look at the fields in that, we basically have filtering for each of the fields available on the movie type. You can see for string fields, we have these various contains, starts with, ends with, and for numeric fields, you have things like greater than, less than, and so on. And so here, let's do a title. Is Jurassic Park or this work, it's going to find us. Okay, so here's Jurassic Park, found it, but we want to know the actors. And so again, just searching for things by control space autocomplete, helps us to kind of see what's available, actors, that sounds like what we're looking for, and actors bring back the name field. So here's our actors in Jurassic Park. And then similar, what are the genres? So let's bring back the genres, Jurassic Park adventure action, sci-fi thriller. And then what other movies are in those genres. So now we can traverse from the genres to other movies, by adding this movies field. However, if I just run this, well, we have potentially, I don't know, tens of thousands of movies in the database, maybe thousands of movies in the database. So there's probably, I don't know, thousands of thrillers, thousands of sci-fi movies. So let's add a limit here. So we can also add arguments at the field level in our selection set. So let's just add a limit tens over each of these genres. Let's just bring back 10 other movies in each of those genres. Cool, did everyone get those? Is anyone stuck or confused on those? I think for those familiar with GraphQL, hopefully this was a bit of a review of the concepts, although maybe I haven't seen this specific API before. V-Sys, cut up, okay, cool, great.
Well, let's go ahead and move on then to talking about data and Neo4j. So that's writing some GraphQL queries and overview of some GraphQL concepts, so let's talk about building our own GraphQL API. But first, we're going to set up our database. And so for this, we're gonna use the Neo4j AuraDB, which is a hosted database as a service from Neo4j that gives us hosted Neo4j instances. And I'll share a link here in the chat, the dev.neufj.com slash neo4j-aura, or you can just search Neo4j Aura in Google. And so we're gonna select the free tier, we can sign up with Google, and maybe a couple of other services, or you can create a username with email and password, and then you'll be asked to choose free tier. There's a few different tiers, there's free, professional, and enterprise tier. So free tier allows us to create databases that are private to us, so we get the connection credentials private to us, but the database stays around. So this is good for hobby projects, if we want the database to stick around for a while. We can also start with loading an existing dataset, so we're going to choose the Graph-Based Recommendations dataset. That's gonna load actually the same movie and user rating data that we were just working with. So let's see what this looks like. I'm gonna go to dev.newtra.com, new from J, dash, Aura, and we'll zoom in a bit, so I'm gonna click on Start Free.
Comments