微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 .net core API 中编写 Cypher 查询

如何解决如何在 .net core API 中编写 Cypher 查询

我有一个类似的 Cypher 查询

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

如何在 .net core 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();

解决方法

你有没有试过只做:

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>());

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。