Latest Movie Review

Latest Movie Review

Write a query that returns a list pertaining to the movie, Toy Story. The list will contain the timestamp of when the movie review was done (from the RATING relationship) and the name of the reviewer.

Who was the last person to review the movie Toy Story?

Once you executed, enter the name below and click Check Answer.

Note: You can use datetime({epochseconds:r.timestamp}) to format the timestamp into something that is readable.

  • ✓ Catherine Trujillo

Hint

First write a MATCH clause to find the users and RATED relationships for the movie Toy Story.

Use a WITH clause to create the list containing the timestamp and user name. Order the nodes retrieved in timestamp order.

RETURN each row as a pair. There should be 247 rows returned.

Who was the last person to review the movie Toy Story?

Once you have entered the answer, click the Try Again button below to continue.

Solution

You can run the following query to find the answer:

cypher
MATCH (m:Movie)<-[r:RATED]-(u:User)
WHERE m.title = "Toy Story"
// create the timestamp/name pair as a list
WITH [datetime({epochseconds:r.timestamp}),u.name] AS Reviews ORDER BY r.timestamp
RETURN Reviews

Who was the last person to review the movie Toy Story?

Once you have entered the answer, click the Try Again button below to continue.

Summary

In this challenge, you wrote a query that collects information about who reviewed a movie and when they reviewed to answer a question about the graph.

In the next challenge, you will write a another query answers a question about nodes that are in the same "neighborhood".