0

I have some nodes of type User that are attached to the root node like so

 var node = _graphClient.Create(new User{Name= "Bob}, new UserBelongsTo(_graphClient.RootNode));

I would like to perform a query that will return all users that are connected to the root node. How do I do this using the neo4jClient?

Aran Mulholland
  • 23,555
  • 29
  • 141
  • 228

1 Answers1

0

Here is what I've come up with so far:

     var results = new CypherFluentQuery(_client)
           .Start("n", _client.RootNode)
           .Match(string.Format("(n)-[:{0}]-(x)", UserBelongsTo.TypeKey))
           .Return<Node<User>>("x")
           .Results;

Note: This is a beginners take on the issue.

Aran Mulholland
  • 23,555
  • 29
  • 141
  • 228
  • 1
    You're better off using '_client.RootNode' rather than '(NodeReference) 0' (which you also can just put as '0' as it's implicitly cast to a NodeReference), as the root node *could* be a different value to zero – Charlotte Skardon Oct 08 '12 at 06:55