neo4jcypher

Why does Neo4j indicate "no changes" after setting null property to null, but not when setting another value to itself?


When I run the following neo4j query, the update summary says "Set 1 property" the first time, but if I re-run it the summary says "(no changes, no records)":

match (u:users {id: $id) set u.isOnline = null

On the other hand, when I run the following query (with the same $token) multiple times the summary always says "Set 1 property":

match (u:users {id:$id}) set u.token = $token

Why is the behavior different?


Solution

  • yes, that's what neo4j behaviour so you must aware of this when working with null values

    When updating null neo4j pre check if value exists like node exists, but it not gonna check for string or an other type of values like array

    so you always get true for string update even for same value