Reputation: 767
I'm building a Neo4j prototype in NodeJS.
I'm running a Cypher query on my local browser to test.
When I run this query, I get this:
MATCH (n) RETURN n;
But when I try to get a User
by the id
property, I get nothing.
This returns nothing
MATCH (u:User {id: 1}) RETURN u;
What am I doing wrong?
Eventually, I want to get the followers of a user using this:
MATCH (:User {id: 2})<-[:FOLLOWING]-(followers) RETURN followers.id;
Upvotes: 1
Views: 117
Reputation: 12684
Try this query below. You need to put the value in quotes (string datatype) and remove duplicates when you return the id.
MATCH (:User {id: "2"})<-[:FOLLOWING]-(followers)
RETURN distinct followers.id
Upvotes: 0
Reputation: 331
Most likely cause is that id
is a string. MATCH (u:User {id: "1"}) RETURN u
should work.
Upvotes: 1