GiteNator
GiteNator

Reputation: 45

Can I bulk delete one node property for all nodes?

I got the data model that has three nodes that are connected with three relations.

This is my data model

By looking at the model it makes no sense to me to store both 2 and 3 letter codes for each Country so I would like to delete all 2 letter ISO codes from countries.

I've tried to run the following code but I get no return.

  MATCH (n:Country)
  WHERE exists(n.iso_2_code)
  REMOVE n.iso_2_code
  RETURN n

What should I do? Is there an alternative way?

Upvotes: 1

Views: 77

Answers (1)

GiteNator
GiteNator

Reputation: 45

According to Memgraph documentation exists is not supported and one should use n.property IS NOT NULL.

The correct code is:

 MATCH (n:Country)
 WHERE n.iso_2_code IS NOT NULL
 REMOVE n.iso_2_code
 RETURN n

Upvotes: 2

Related Questions