-3

>,= is working but less than operator is not working in cypher neo4j.

What may be the reason ?

Elikill58
  • 4,050
  • 24
  • 23
  • 45
nik12
  • 5
  • 2
  • What do you mean with "not working" ? You get an error ? It don't return true when it must be ? – Elikill58 Jul 16 '21 at 06:32
  • No, i didn't get any error .<, = operator is working means i got result if value is greater than 41 or equal, but if value is less than 41 then output showing nothing , values are also present – nik12 Jul 16 '21 at 06:52
  • And so `<` don't show value ? are you sure that you didn't assign value to var. Also, can you show codes ? – Elikill58 Jul 16 '21 at 06:59
  • MATCH (n:ProjectField) Where n.value < "41" RETURN n output: "value": "100" "value": "40214" "value": "12345" – nik12 Jul 16 '21 at 07:02
  • 2
    welcome to stackoverflow. i recommend [taking the tour](https://stackoverflow.com/tour), as well as reading [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and [what's on topic](https://stackoverflow.com/help/on-topic). – Franz Gleichmann Jul 16 '21 at 07:05
  • And can you edit your first post with that code, and format it ? It will be more useful. Just here I see that you are comparing string and int – Elikill58 Jul 16 '21 at 07:05
  • Actually values are saved in string in neo4j database through UI , And need to find the the less than that values. Why this happens. i got result for greater than and for Equal using this same query. just not getting for less than – nik12 Jul 16 '21 at 07:16

1 Answers1

0

From your comment MATCH (n:ProjectField) Where n.value < "41" RETURN n output: "value": "100" "value": "40214" "value": "12345" i assume the values you compare are string values (hece the ""). In that case cypher uses string comparison and since 1 is smaller than 4 in the first char it think 100 is smaller than 41.

You can try to update the string numbers to integers or compare the integervalues of n.value using toInteger.

Urr4
  • 611
  • 9
  • 26