You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.
I am using neo4j-graphql-js and in one of my cypher statement's I'm referring to "this" which is the current node. It seems that the word "this" in my first MATCH is accurate, but then when I use MATCH the second time, "this" becomes just a general keyword and defaults to an unlabeled/non-specific node (and just returns everything).
Here's the code currently. it finds any posts that are either tagging "Things" that are children of the current Thing node, or where they're tagging the current Thing node specifically.
MATCH (this)<-[:CHILD_OF]-(t1:Thing)<-[:TAGGED]-(post:Post)
WITH COLLECT(post) as rows
MATCH (this)<-[:TAGGED]-(p:Post)
WITH rows + COLLECT(p) as allRows
UNWIND allRows as post
RETURN count(DISTINCT post)
Any ideas how I can reuse "this" the second time? I tried sharing it after WITH COLLECT(post) as rows, like this:
WITH COLLECT(post) as rows, this
Any ideas would be appreciated, thank you in advance!
The text was updated successfully, but these errors were encountered:
Is it possibly that "this" doesn't exist, and I need to instead use OPTIONAL, so that if it fails, it still continues on? I think it might be stopping there?
Is that accurate? So this should work?:
OPTIONAL MATCH (this)<-[:CHILD_OF]-(t1:Thing)<-[:TAGGED]-(post:Post)
WITH COLLECT(post) as rows, this
OPTIONAL MATCH (this)<-[:TAGGED]-(p:Post)
WITH rows + COLLECT(p) as allRows
UNWIND allRows as post
RETURN DISTINCT post
ORDER BY post.date DESC
I am using neo4j-graphql-js and in one of my cypher statement's I'm referring to "this" which is the current node. It seems that the word "this" in my first MATCH is accurate, but then when I use MATCH the second time, "this" becomes just a general keyword and defaults to an unlabeled/non-specific node (and just returns everything).
Here's the code currently. it finds any posts that are either tagging "Things" that are children of the current Thing node, or where they're tagging the current Thing node specifically.
Any ideas how I can reuse "this" the second time? I tried sharing it after WITH COLLECT(post) as rows, like this:
Any ideas would be appreciated, thank you in advance!
The text was updated successfully, but these errors were encountered: