Question

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" : [ ]
}

And the query itself, formatted for readability:

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

Now, if I run this in neo4j-shell:

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

I receive expected result, a node with a user.

Apparently, I don't if I send this query. What gives?

PS. If it matters, the library that actually sends the request is the httpstream.

Was it helpful?

Solution

Omit the quotes around the parameter:

{"query":
"
CYPHER 1.9
START user = node(*)
WHERE user.password? = {password}   // <---- quotes removed here
RETURN user
",
"params":
    { "password":
      "$2a$12$5.OLqPRaoAhItdfAgNZZYeCf8TJzSM2aMmnK8a.K2DdrKOoMhKOpi" } }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top