如何在neo4j中将数组的字符串值转换为整数?

问题描述 投票:0回答:1

我无法将数组的字符串值(例如score:["1", "0"])转换为Neo4j中的Integer。

我试过了:

MATCH (n:Game {game_id:"1"})
RETURN toInteger(n.score[0])

此查询返回null值作为结果。

neo4j spring-data-neo4j spring-data-neo4j-4 neo4j-ogm
1个回答
0
投票

我尝试了你的查询,但它对我来说很好。这是我的示例数据集:

CREATE (n:Game {game_id:"1", score:["1","0"]})

这是查询:

MATCH (n:Game {game_id:"1"})
RETURN toInteger(n.score[0])

它返回:

╒═══════════════════════╕
│"toInteger(n.score[0])"│
╞═══════════════════════╡
│1                      │
└───────────────────────┘
© www.soinside.com 2019 - 2024. All rights reserved.