Check out a free preview of the full Complete Intro to Databases course

The "Neo4j" Lesson is part of the full, Complete Intro to Databases course featured in this preview video. Here's what you'd learn in this lesson:

Brian introduces Neo4j, a graph database, and demonstrates how to create and connect to a Neo4j database using Docker.

Preview
Close

Transcript from the "Neo4j" Lesson

[00:00:00]
>> Like where's the name neo4j come from? That's a kind of a strange name. Back in the early, early parts of tech, it was really popular to put four in names of things. And so this is actually even before my time in tech, but this was like a popular naming convention.

[00:00:24]
So Neo was just the name of the product and then 4j was this enterprise product, right? That's kind of what that 4j meant. I'm sure someone can come in here and explain that mean more thoroughly than me, but it was kind of, On topic at the time that I think it just stuck around.

[00:00:43]
I remember there was an April Fool's post from neo4j that they were going to read. They were releasing soon, a version, they would call it neo5j and people took it very seriously. And it was a joke that it's neo4j they're gonna stick for with neo4j. Okay, so let's get our neo4j up and running here.

[00:01:03]
I got your Docker command here ready to go, we're going to hop into our command line. Let's just, I'm gonna shut down my postgres here. Docker kill my postgres. I think I've just saved, I have to kill my hasura as well. Okay, I have nothing running. Now I'm going to paste that in here.

[00:01:34]
Docker run, detach interactive TTY, I actually don't need that part. dash dash RM, remove the logs when you're done. Name my new 4j Port 7474. That is the port of the browser interface to neo4j. 7686 is the port that is actually reading and writing to, so our app will actually use 7687.

[00:01:57]
And then we're telling it to use no auth because I'm just playing around with it on our local computer. Obviously, don't do that in your production database. And then we'll be doing neo4j:4.1.3. And that should start up pretty quickly. Again, these are all running immediately in my computer because I have them downloaded already.

[00:02:18]
This will probably take you, depending on how fast your internet is, 30 seconds to start up. So now you can see here I got this up and running, it's exposing the port's that I want, everything is looking great. So we're gonna come back over here and we're gonna run this command right here.

[00:02:44]
Docker exec dash it maione neo4j. And then we're going to run a command line utility called cipher shell. So let's talk about what cipher is. Just like MongoDB uses JSON and JavaScript and postgres uses SQL. There is a query language for neo4j, and it is called Cipher. So it is a peculiar query language made particularly for neo4j's.

[00:03:14]
I don't believe it's used anywhere else. There is another query language that's pretty well known, it's called Gremlin, which is different than the company Gremlin. Gremlin is the Apache query language. But we'll will not be using that today. We'll be using cipher. Yeah, question? Does graph QL fit in here with a graph database?

[00:03:35]
It's a very fair question. I think the, the answer to that is it could. Graph QL was made to query Facebook, which is very graph-like in nature, right? It doesn't necessarily fit in, out of the box, I can't just start using graph QL to query against neo4j. I don't know the utility to make it work with neo4J, but I don't doubt it exists.

[00:04:01]
Is that a dodgy enough answer to that? [LAUGH] So, my answer there is not necessarily, but probably could.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now