Testing List Inclusion

Neo4j supports storing a single value or an array of values of the same type within a property.

In our data model, every :Movie node has a languages property which contains an array of strings. For example ['English', 'German', 'Italian'].

Finding German Language Movies

Write and execute a query to return movies released in the "German" language.

Note: You only need to search for "German"; there are elements in the database that have " German" as a language. You do not need to count these.

How many Movie node names are returned?

  • ✓ 105

Hint

Use IN to test whether "German" is in the languages list property for the Movie node.

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) 
WHERE "German" IN m.languages
RETURN count(m)

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

Summary

In this challenge, you wrote and executed a basic query to test if a value is in a list for a node.

The next lesson will teach you more about evaluating strings in your queries.