O'Reilly logo

Learning Neo4j 3.x - Second Edition by Rik Van Bruggen, Jérôme Baton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding data with a default value

Let's use the towers again, should we want to know if they host a restaurant or not. A yes/no field is a perfect fit for a Boolean property. We shall call this query, assuming it is a waste to build a tower and not fit a restaurant in it. We do this as follows:

MATCH (n:Tower) SET n.hasRestaurant = toBoolean("true")RETURN n 

Notice the conversion to a Boolean value that then allows shortening of the queries:

MATCH (n:Tower) WHERE n.hasRestaurant RETURN n

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required