SomeNode 및 OtherNodes의 모든 속성과 ID를 가져 오려고합니다.속성 (n)을 사용하는 cypher 요청과 함께 노드 ID를 가져 오는 방법은 무엇입니까?
나는이 쿼리가 :
const neo = driver.session();
const responseObj = { error: false, message: 'success: getting nodes' };
const q = 'MATCH (n:SomeNode)-[:has]->(o:OtherNode), ' +
' RETURN properties(n) AS node, properties(o) AS otherNode';
neo.run(q)
.then((result) => {
const records = result.records;
const nodes = [];
records.forEach((record) => {
nodes.push({
node: record.get('node'),
other: record.get('otherNode')
});
});
responseObj.nodes = nodes;
neo.close();
respond(null, responseObj);
});
이 예상대로 SomeNode의 속성과 OtherNode의 특성을 가진 객체의 배열을 날 다시 제공을하지만, 나는 또한 SomeNode 및 OtherNode의 id의 필요합니다. 가장 좋은 방법은 무엇입니까?
노드가 반환되면 ID를 가져 오는 방법은 무엇입니까?
당신은 예를 들어, 속성과 함께 ID를 반환하는지도 투영을 사용할 수
노드를 반환 할 때 ID를 얻는 올바른 방법은 무엇입니까? – cmac
node.properties.id ...가 표시되지 않습니까? – cmac
출력을 소비하는 방법에 따라 다릅니다. 브라우저에서 결과의 코드보기 탭을 보면 반환 된 데이터에 ID가 표시되어야합니다. neo4j 드라이버를 통해 결과에 액세스하는 경우 반환 된 노드 결과의 식별자에 유사하게 액세스 할 수 있어야합니다 (해당 노드가 아닌 '속성'과 동일한 수준). – InverseFalcon