Adding Properties to a Movie

In the Creating a Relationship challenge, we created a new Movie node for the movie Get Out. However, we forgot to add a a tagline or release year.

Run this Cypher, you will see that the tagline and released properties are null:

cypher
MATCH (m:Movie {title: 'Get Out'})
RETURN m.title, m.tagline, m.released

Modify this Cypher to use the SET clause to add the following properties to the Movie node:

  • tagline: Gripping, scary, witty and timely!

  • released: 2017

Validate Results

Once you have run the query, click the Check Database button and we will check the database for you.

Hint

Use MATCH to find the Movie node and then use SET to add the properties using the reference to the node. Use a comma (,) to separate the properties you are adding.

For example:

cypher
MATCH (x.Label)
SET x.firstProp = "xxx", x.secondProp = yyy

Find the Movie and check that the node’s properties have been set:

cypher
MATCH (m:Movie {title: 'Get Out'})
RETURN m.title, m.tagline, m.released

If you view the node in table view, you will see the properties.

The properties name and values are case sensitive.

Solution

You can run the following query to set the tagline and released properties for Get Out.

cypher
MATCH (m:Movie {title: 'Get Out'})
SET  m.tagline = 'Gripping, scary, witty and timely!',
     m.released = 2017

Summary

In this challenge, you demonstrated that you can add properties to a node. In the next lesson, you will learn how to add or update properties when a node is created or retrieved.