Neo4j :使用密码查询检索自动生成的节点 id


Neo4j :Using cypher query to retrieve auto generated id of the node

我是neo4j的新手。

我想使用密码查询检索自动生成的节点 ID。

我正在使用 php。

怎么可能?另外,如何在 php 变量中仅获取节点的 id?

MATCH (n)
RETURN ID(n) as nodeId

查看文档:http://docs.neo4j.org/chunked/milestone/query-functions-scalar.html#functions-id

编辑:

我不太了解PHP,但假设你正在使用neo4jphp我想一般的想法是这样的

$client = new Everyman'Neo4j'Client();
$queryString = "MATCH (n) RETURN ID(n) as nodeId";
$query = new Everyman'Neo4j'Cypher'Query($client, $queryString);
$result = $query->getResultSet();
echo $result[0]['nodeId']

您将需要在此处阅读neo4jphp,特别是如何使用密码。或者你可以将php cURL与Neo4j REST API一起使用。