Anusha
Anusha's Blog

Anusha's Blog

Launching your first Neo4j AuraDB Instance

Photo by Andrew Neel on Unsplash

Launching your first Neo4j AuraDB Instance

Anusha's photo
Anusha
·Aug 28, 2022·

2 min read

Subscribe to my newsletter and never miss my upcoming articles

I explore this space first time as I write this article. I have worked with Neo4j before and written few basic cypher queries. But, never went on to use the AuraDB yet. Let's do that today. And try a few of GraphQL queries. This would be my first on the go exploratory journal.

image.png I'll pick the "StackOverflow Data", you could pick any of the choices that you prefer: image.png

You'll be given the credentials to store which will be used to connect to the instance. Keep it stored safely. Once the instance is ready, it should show up in the Running state:

image.png Resources/sample code are available to you to reference in your preferred language, I'll pick GraphQL, I have copied example.js to my local machine, updated my username and password fields and the run the code to launch my Apollo server at localhost:4000,

npm install @neo4j/graphql graphql apollo-server neo4j-driver
node example.js

If you want to quick explore, you could make use of Neo4j Bloom. Show me a graph allows you to form queries on the fly,

image.png

GraphQL server ready at http://localhost:4000/

image.png

If you are completely new to GraphQL, then use the explorer to guide you through the queries as it helps auto complete as you type in, The very first query I ran was from the example, to create Person nodes:

mutation {
  createPeople(
    input: [
      {
        name: "Alice"
        knows: { create: [{ node: { name: "David" } }] }
      }
    ]
  ) {
    people {
      name
      knows {
        name
      }
    }
  }
}

I wrote a few more queries with new Person names, to create more Person nodes. With some same names to understand, if the queries created a new node even if the names were same. Yes, it did. Because the query was create, not update, or add to the same person node/id. Now, I wanted to run the some queries on Insomnia as well, to check if I could get the list of Persons I just created,

image.png

I then wanted to quick recap on, who all I created who knows the others -

query {
people {
  name
  knows {
    name
  }
}
}

image.png

image.png

Another simple query to find Person names that contain "y",

image.png

Hope you too enjoyed this little exercise as much I did, see you again with something interesting. Thank you :)

 
Share this