I just got started on Neo & tried to look for prior questions on this topic. I need help to rename one of the property keys.
I created the following node:
CREATE (Commerce:Category {title:' Commerce', Property:'Category', Owner:'Magic Pie', Manager:'Simple Simon'})
Now want to rename title to name. Is there a way to do it? I don't want to delete the node as there are 100's of nodes with the property "title".
propkeys — Property keys Property keys in the Neo4j database, returned as a cell array of character vectors. Each character vector denotes a property key.
You cannot rename an already existing relationship. You'd have to run through all relationships, create the new one in parallel (including all properties) and then remove the old one.
(b) Use Neo4j, by creating a node per key-value setting the key and value as properties on the node, but there is no relationship other then having an index to group these nodes together, exposing the key of the key-value as the key on the index.
To create a relationship between two nodes, we first get the two nodes. Once the nodes are loaded, we simply create a relationship between them. The created relationship is returned by the query.
Yes, you want to SET
a new property name
with the value of the old property title
. And then REMOVE
the old property title
. Something like this...
MATCH (c:Category)
WHERE c.name IS NULL
SET c.name = c.title
REMOVE c.title
If you have MANY nodes, it is advisable to perform the operation in smaller batches. Here is an example of limiting the operation to 10k at a time.
MATCH (c:Category)
WHERE c.name IS NULL
WITH c
LIMIT 10000
SET c.name = c.title
REMOVE c.title
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With