Top Movies

Using WITH for map projection

This query uses WITH to return a map projection of the top 10 movies by IMDb rating.

cypher
MATCH (n:Movie)
WHERE n.imdbRating IS NOT NULL
WITH n {
  .title,
  .imdbRating
}
ORDER BY n.imdbRating DESC
LIMIT 10
RETURN collect(n)

Modify this query to add the following properties to the map projection:

  • plot

  • released

  • countries

Click to reveal the solution
cypher
MATCH (n:Movie)
WHERE n.imdbRating IS NOT NULL
WITH n {
  .title,
  .imdbRating,
  .plot,
  .released,
  .countries
}
ORDER BY n.imdbRating DESC
LIMIT 10
RETURN collect(n)

Click Complete when you are ready to move on.

Summary

In this challenge, you used the WITH clause to create a map projection.

In the next challenge, you will answer another question about the graph.