cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Example in official apoc doc failed to run in neo4j sandbox

Cannot run the following example (copied from Graph Grouping - APOC Documentation) in neo4j sandbox.

CREATE
 (alice:Person {name:'Alice', gender:'female', age:32, kids:1}),
 (bob:Person   {name:'Bob',   gender:'male',   age:42, kids:3}),
 (eve:Person   {name:'Eve',   gender:'female', age:28, kids:2}),
 (graphs:Forum {name:'Graphs',    members:23}),
 (dbs:Forum    {name:'Databases', members:42}),
 (alice)-[:KNOWS {since:2017}]->(bob),
 (eve)-[:KNOWS   {since:2018}]->(bob),
 (alice)-[:MEMBER_OF]->(graphs),
 (alice)-[:MEMBER_OF]->(dbs),
 (bob)-[:MEMBER_OF]->(dbs),
 (eve)-[:MEMBER_OF]->(graphs)

^^^ succeeded

CALL apoc.nodes.group(['*'],['gender'],
  [{`*`:'count', age:'min'}, {`*`:'count'} ])

^^^ failed with the following error:

Something went wrong: *"TypeError: Cannot read property 'join' of null"* and the application can't recover.

Tried in neo4j 4.2.1 + apoc 4.2.0.0 installed on my mac and ran into the same issue.

Tried to replace ` in `*` with ' and ran into the following error:

Invalid input '[': expected "+" or "-" (line 1, column 40 (offset: 39))
"CALL apoc.nodes.group(['*'],['gender'],[{'*':'count', age:'min'},{'*':'count'}])"

Does anyone know what is wrong with the "query"? Thanks!

1 REPLY 1

Unfortunately it is not a problem of the procedure itself,
but of the Neo4j Browser view engine.
In fact, trying the query with cypher-shell it works (or also selecting "Table" mode instead of "Graph" mode on Neo4j Browser).
The problem is due to some virtual nodes with null properties that the view engine cannot render. (in this case : Forum {gender: NULL, count_ * : 2).

In fact using a query with results with non-null properties (for example the next example on the documentation) works.

The magic thing is that sometimes, after several attempts, it even displays the query with null properties without errors.