首页 > 解决方案 > 如何在 .net core API 中编写 Cypher 查询

问题描述

我有一个这样的密码查询

MATCH (n: learningPaths) 
WHERE any(x IN n.modules WHERE x = "any course")
RETURN n

如何在 .net 核心 API 中编写此查询以获取结果

以前我有这样的查询

MATCH (n:learningPaths)-[]->(m:modules) 
WHERE m.id = "any course" 
RETURN n;

我在 .net core API 中写下

var result = (
    await _graphClient.Cypher
          .Match(@"(n:learningPaths)-[]->(m:modules)")
          .Where<modules>(m => m.id == "any course")
          .Return((n)=>  n.As<learningPaths>())
          .ResultsAsync)
          .ToList();

标签: asp.net-coreneo4jcypherneo4jclient

解决方案


您是否尝试过这样做:

var query = client.Cypher
    .Match("MATCH (n:learningPaths)-->(m:modules)")
    .Where("any(x IN n.modules WHERE x = 'any course')"
    .Return( n => n.As<learningPaths>());

推荐阅读