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.

How can I return a Map Projection from a cypher directive?

geronimo4j
Graph Buddy

I have the below cypher directive, which returns if you run it in the Neo4j browser (swapping out this )

 homepage_posts: [Post] @cypher(statement: """
        MATCH (this)-[:FOLLOWS]->(something)-[:WROTE|TAGGED]-(post:Post)
        WITH post, ('User' IN labels(something)) AS followingAuthor
        RETURN DISTINCT post{.*, followingAuthor: followingAuthor}
        ORDER BY post.date
    """),

However, when I run this as a query using neo4j-graphql-js, it does not return. Instead it gives this error: ERROR [Error: Expected to find a node at ref slot 0 but found Map{...} instead

It does return if I get rid of the map projection ( {.*, followingAuthor: followingAuthor} ), so that's definitely where my problem appears to be. Is this perhaps unsupported by neo4j-graphql-js?

Thank you in advance!

1 REPLY 1

I would also love to know the answer to this