我正在尝试将查询从 cypher 转换为在 c# 中使用 neo4jclient api
这是我的密码
start server=node:node_auto_index(serverId='SHO2K3MS49')
MATCH
server-[:IS_SERVER_TYPE]->type,
appEnv-[:HAS_SERVER]->server,
app-[:HAS_ENV]->appEnv
return
server.serverId,
collect([
appEnv.environmentTypeId,
appEnv.appEnvId,
app.appId,
app.appName
]) ;
该查询为每个服务器返回一行并收集该服务器上的所有应用程序。
据我所知, .CollectAs api 只允许单个值。
一个想法如何使用 .net api 做到这一点?
编辑
我刚刚试过这个查询
_connectedClient
.Cypher
.Start(new {server = Node.ByIndexLookup("node_auto_index", "serverId", "SHO2K3MS49") })
.Match("server-[:IS_SERVER_TYPE]->type", "appEnv-[:HAS_SERVER]->server", "app-[:HAS_ENV]->appEnv")
.Return((server, appEnv, app) =>
new
{
ServerName = Return.As<string>("server.serverId"),
aa = Return.As<dynamic> ("collect([appEnv.environmentTypeId,appEnv.appEnvId,app.appId,app.appName])")
})
.Results;
并收到了这个结果。
堆栈跟踪
at Neo4jClient.Serialization.CypherJsonDeserializer`1.Deserialize(String content)
at Neo4jClient.GraphClient.<>c__DisplayClass1e`1.<Neo4jClient.IRawGraphClient.ExecuteGetCypherResultsAsync>b__1d(Task`1 responseTask)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
内部异常
Accessed JArray values with invalid key value: "data". Array position index expected
消息- 为简洁起见删除了样板文本
Neo4jClient encountered an exception while deserializing the response from the server. This is likely a bug in Neo4jClient.
Include the full type definition of <>f__AnonymousType1`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].
Include this raw JSON, with any sensitive values replaced with non-sensitive equivalents:
{"columns":["ServerName","aa"],"data":[["SHO2K3MS49",[["PRD","MATT.PRD","MATT","MATT"],["PRD","ARCSERV.PRD","ARCSERV","ArcServ"],["PRD","ACTIVE DIRECTORY _WINDOWS SERVER NETWORKING_.PRD","ACTIVE DIRECTORY _WINDOWS SERVER NETWORKING_","Active Directory (Windows Server networking)"]]]]}
Parameter name: content