0

I have a node with internal id 35831. I run the following code in the Neo4J Browser:

:params "id": 35831

match (t) where id(t) = $id return t

Expected result: the node

Actual result: (no changes, no records)

Is this expected behavior or should I provide info about my neo4j version?

Dominik Teiml
  • 505
  • 1
  • 4
  • 12

2 Answers2

1

In the Neo4j browser, when you set a numerical parameter its type is a float. See the result when you type :params "id": 35831, you should see 35831.0 as a value.

And that's why your query returns nothing...

But if you use this query MATCH (n) WHERE id(n)=toInteger($id) RETURN n it works !

FYI, this is only true for the browser, if you use the cypher-shell, it will works like you want :

neo4j> :param id 5
neo4j> MATCH (n) WHERE id(n)=$id RETURN n;
logisima
  • 7,340
  • 1
  • 18
  • 31
1

You can use following syntax to set a parameter in the browser:

:param id => 1

....

{
  "id": 1
}

Then your query will work just fine:

 match (t) where id(t) = $id return t
František Hartman
  • 14,436
  • 2
  • 40
  • 60