Is it possible to add a temporary property to a neo4j node for return only?

You can try returning a map projection. Take a look in this example:

// Creating a sample node    
CREATE (:Person {name:'Jon', id: 1})

Returning the projection with a extra boolean:

MATCH (p:Person {id:1})
WITH p, true AS has_children
RETURN p{.*, has_children:has_children}

The result:

╒═════════════════════════════════════════╕
│"p"                                      │
╞═════════════════════════════════════════╡
│{"id":1,"name":"Jon","has_children":true}│
└─────────────────────────────────────────┘

The above query is returning all properties of p node with an extra boolean.

Tags:

Neo4J

Cypher