javascript neo4-driver无法返回多个变量

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

我使用neo4j-driver来查询neo4j。这个工作大多没问题,但命令:

match (city:city)-[r:lies_in]->(country:country) return city,country

只返回城市。完全相同的命令在Neo4j-Browser中完美运行并返回城市和国家。

这是来自neo4j query.log的行:

2019-04-25 07:19:21.870+0000 INFO  4 ms: bolt-session   bolt        neo4j-javascript/1.7.3      client/127.0.0.1:49824  server/127.0.0.1:7687>   - match (city:city)-[r:lies_in]->(country:country) return city,country - {} - {}

这是相关的代码:

const neo4j = require('neo4j-driver').v1;

            const driver = neo4j.driver('bolt://127.0.0.1:7687', neo4j.auth.basic('', ''));
            const session = driver.session();

            console.log (command);

            session.run(
              `${command}`
            )
            .then(result => {
              session.close();
              console.log (result);

记录结果:enter image description here

javascript neo4j cypher
1个回答
0
投票

您只消耗结果的第一条记录。

有关如何迭代结果流中的其余记录,请参阅driver documentation

© www.soinside.com 2019 - 2024. All rights reserved.