# Set new node property

**URL:** <https://community.neo4j.com/t/set-new-node-property/72851>\
**Category:** Cypher\
**Created:** [March 2, 2025, 11:27am UTC](https://community.neo4j.com/t/set-new-node-property/72851 "2025-03-02T11:27:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iganea9](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/iganea9/32/21194_2.png) [@iganea9](https://community.neo4j.com/u/iganea9)\
**Post date:** [March 2, 2025, 11:27am UTC](https://community.neo4j.com/t/set-new-node-property/72851/1 "2025-03-02T11:27:55Z")

</div>

I have nodes in neo4j 5.21 created with these properties:  
`MERGE (rm:RainfallMonth {month: 'Jan', year: 2023, location: 'South', rainfall: 80})`  
I want to include a new name property that will automatically modify the node:

```auto
MATCH (rm:RainfallMonth)
SET rm.name = 'Rainfall ' + rm.month + ' ' + toString(rm.year) + ' ' + rm.location;

```

The result shows confirmation of the creation of the properties, but the property does not appear in the nodes.

 ![node](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/8/c/8c82c456aa4fd7cbdd1f625fccf7ad79b1333594.png)

---

<div class="post-metadata">

**Author:** ![christoffer.bergman](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/christoffer.bergman/32/30805_2.png) [@christoffer.bergman](https://community.neo4j.com/u/christoffer.bergman)\
**Post date:** [March 3, 2025, 7:12am UTC](https://community.neo4j.com/t/set-new-node-property/72851/3 "2025-03-03T07:12:51Z")

</div>

If I just run these three queries in sequence on an empty database I get the expected result:

```auto
MERGE (rm:RainfallMonth {month: 'Jan', year: 2023, location: 'South', rainfall: 80})

```

```auto
MATCH (rm:RainfallMonth)
SET rm.name = 'Rainfall ' + rm.month + ' ' + toString(rm.year) + ' ' + rm.location;

```

```auto
MATCH (rm:RainfallMonth)
RETURN rm.name LIMIT 20

```

 ![rainfall](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/c/3/c3dd9c32bbbd717bf8b16076bdf648d11ff69550.png)

So if I look at your screenshots I can only come up with one theory: If either month, year or location is null, then the name property would also become null. However, in the SET-statement it wouldn't claim to have set the property, but we see in your screenshot that 289 properties did get set. However, I don't know how many RainfallMonth nodes you have in your database. If that is more than 309, then it might me that 289 gets correctly set, but you still have at least 20 that are not, and when you do your RETURN rm.name LIMIT 20 you just happen to get 20 of the nodes that did not get set (those are probably the first 20 nodes created, so maybe the first nodes were not correctly created?)

---

<div class="post-metadata">

**Author:** ![iganea9](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/iganea9/32/21194_2.png) [@iganea9](https://community.neo4j.com/u/iganea9)\
**Post date:** [March 3, 2025, 8:39am UTC](https://community.neo4j.com/t/set-new-node-property/72851/4 "2025-03-03T08:39:36Z")

</div>

All node properties contain data, they are not null.  
There are 817 nodes of type 'RainfallMonth'  
The 'name' property was set only for location: 'South', for 'North' and 'Center' they were not set.  
528 properties received the 'name' property null.  
When explicitly filtering the property location= 'Center' it is not done.

 ![image](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/d/d/dd08a243c7e1ab7a14f9a7110dd3008c64104c23.png)

How can I set it to add the name property for all nodes?

---

<div class="post-metadata">

**Author:** ![joshcornejo](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/joshcornejo/32/34171_2.png) [@joshcornejo](https://community.neo4j.com/u/joshcornejo)\
**Post date:** [March 3, 2025, 11:09am UTC](https://community.neo4j.com/t/set-new-node-property/72851/5 "2025-03-03T11:09:59Z")

</div>

All nodes have the month, year and location properties set? no null?

---

<div class="post-metadata">

**Author:** ![iganea9](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/iganea9/32/21194_2.png) [@iganea9](https://community.neo4j.com/u/iganea9)\
**Post date:** [March 3, 2025, 11:22am UTC](https://community.neo4j.com/t/set-new-node-property/72851/6 "2025-03-03T11:22:29Z")

</div>

I found the problem. There was a year and Year property. I transferred Year into year and it worked.

```auto
MATCH (rm:RainfallMonth)
RETURN DISTINCT keys(rm);
                                       
["name", "location", "month", "year"] 
["rainfall", "Year", "location", "month"]
["Year", "location", "month"]
["name", "rainfall", "location", "month", "year"]

```

Thanks and sorry for taking up your time.
