Search code examples
neo4jcypherneo4jclient

Using "And" for cypher in Neo4jClient


I have a cypher query that looks like this:

start n = node:node_auto_index(Department = "IT") match (n)-->(x) Where x.Name = "Mike" And x.Occupation = "Developer" return x;

This returns all nodes related to the root node if the Name is Mike and the Occupation is developer.

Now how do I do the "And x.Occupation" in C#?

var query = this.clientConnection
      .Cypher
      .Start(new
      {
         n = Node.ByIndexLookup("node_auto_index", "Department", "IT")
      })
      .Match("n-->x")
      .Where((Employee x) => x.Name == "Version" //"AND" x.Occupation = "Developer)
      .Return<Node<IQS_Content_Manager.Models.Nodes.Version>>("(x)")
      .Results;

queryResult = query.ToList();

Solution

  • .Where((Employee x) => x.Name == "Version")
    .AndWhere((Employee x) => x.Occupation == "Developer)