0
POST /db/data/cypher HTTP/1.1
Accept-Encoding: identity
Content-Length: 243
Host: localhost:7474
Content-Type: application/json
X-Stream: true;format=pretty
User-Agent: py2neo/1.6.0 HTTPStream/1.0.9 Python/2.7.3-final-0 (linux2)

{"query":"\n            CYPHER 1.9\n            START user = node(*)\n            WHERE user.password? = '{password}'\n            RETURN user\n            ","params":{"password":"$2a$12$5.OLqPRaoAhItdfAgNZZYeCf8TJzSM2aMmnK8a.K2DdrKOoMhKOpi"}}HTTP/1.1 200 OK
Content-Length: 44
Content-Type: application/json; charset=UTF-8
Access-Control-Allow-Origin: *
Server: Jetty(6.1.25)

{
  "columns" : [ "user" ],
  "data" : [ ]
}

查询本身,为了可读性而格式化:

{"query":
"
CYPHER 1.9
START user = node(*)
WHERE user.password? = '{password}'
RETURN user
",
"params":
        { "password":
          "$2a$12$5.OLqPRaoAhItdfAgNZZYeCf8TJzSM2aMmnK8a.K2DdrKOoMhKOpi" } }

现在,如果我在 neo4j-shell 中运行它:

start user = node(*) 
where user.password = '$2a$12$5.OLqPRaoAhItdfAgNZZYeCf8TJzSM2aMmnK8a.K2DdrKOoMhKOpi' 
return user;

我收到了预期的结果,一个带有用户的节点。

显然,如果我发送此查询,我不会。是什么赋予了?

PS。如果重要的话,实际发送请求的库是httpstream.

4

1 回答 1

1

省略参数周围的引号:

{"query":
"
CYPHER 1.9
START user = node(*)
WHERE user.password? = {password}   // <---- quotes removed here
RETURN user
",
"params":
    { "password":
      "$2a$12$5.OLqPRaoAhItdfAgNZZYeCf8TJzSM2aMmnK8a.K2DdrKOoMhKOpi" } }
于 2013-10-03T16:32:48.123 回答