Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am new to neo4j and trying to add multiple values to a property of a node.How to do it?

 create (e:Employee{name:"Sam",languages:["C","C#"]})

Tried this but didn't find any proper way to add multiple values to an attribute.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
272 views
Welcome To Ask or Share your Answers For Others

1 Answer

Properties cannot have object values. If you're looking to store multiple properties on language, and those properties all belong to the language and not any other entity, then you should model Language as a node. You can store properties on the relationship between the employee and language as well if required.

Then you'll end up with something like this:

create (l:Language {name:"C", otherProperty:"property value"})
create (e:Employee {name:"Sam"})
create (e)-[:SPEAKS {level:"Fluent"}]->(l)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...