首页 > 解决方案 > 如何从密码可变长度关系查询中提取值?

问题描述

我正在尝试从 cyper 可变长度关系查询结果中提取名称列。但不确定如何从复杂对象中获取名称列。下面是我正在尝试但无法成功的代码。

或者

请告知是否有任何方式调整查询以获得指定的值。

session.run('match path=(n)-[:DATA*..3]-(m) where n._nme=$source and 
m._nme=$destination return path ', 
{source:source,destination:destination}).then(function(result) {
result.records.forEach(function(record){
console.log(record._fields[0].properties.nme);
});
});

这是记录json

records: (215) […]
​[0…99]
​​[100…199]
​​[200…214]
​​length: 215
​​<prototype>: Array []
​summary: Object { statementType: "r", plan: false, profile: false, … }
​<prototype>: Object { … }

这里扩展的json

records: (215) […]
​​  [0…99]
​​​     0: {…}
​​​​            _fieldLookup: Object { path: 0 }
            ​​​​_fields: (1) […]
                ​​​​​0: {…}
                    ​​​​​​end: Object { identity: "110", labels: (1) […], properties: {…} }
​​​​​​                  length: 3
                    ​​​​​​segments: Array(3) [ {…}, {…}, {…} ]
                    ​​​​​​start: Object { identity: "92", labels: (1) […], properties: {…} }
                    ​​​​​​<prototype>: Object { … }
                ​​​​​length: 1
                ​​​​​<prototype>: Array []
        ​​​​keys: Array [ "path" ]
​​​​        length: 1
​​​​        <prototype>: Object { … 

}

标签: node.jsneo4j

解决方案


推荐阅读