I am trying to put a where clause in my Neo4j cypher query to return some nodes, this is the query im trying to perform:
start n = node:node_auto_index(Name = "Contact Details") Match (n)--(x) Where x.Type = "Version" Return x;
Now my C# method looks like this(using Neo4jClient):
public IEnumerable<Node<VersionNode>> GraphGetAllVersionNodes(string nodeName)
{
clientConnection = graphOperations.GraphGetConnection();
IEnumerable<Node<VersionNode>> queryResult = null;
var query = clientConnection
.Cypher
.Start(new
{
n = Node.ByIndexLookup("node_auto_index", "Name", nodeName)
})
.Match("(n)--(x)")
.Where((VersionNode x) => x.Type = "Version")
.Return<Node<VersionNode>>("(x)")
.Results;
queryResult = query.ToList();
return queryResult;
}
Now there is an error on the where clause saying:
Cannot convert lambda expression to type 'string' because it is not a delegate type
What am I doing wrong here?
Thanks
If that's a verbatim copy-paste, then I'm guessing the issue is that you wrote:
.Where((VersionNode x) => x.Type = "Version")
When you need to write:
.Where((VersionNode x) => x.Type == "Version")
PS. What's the point of IEnumerable<Node<VersionNode>> queryResult = null;
instead of just var queryResult =
? You never assign it in any other path, so it's just a waste of code and an extra signature to maintain.