5

Can we have multiple properties of a node to identify it uniquely in neo4j graph database?

Something like composite primary key, in RDBMS, to uniquely identify a row of a table.

Ahmed Akhtar
  • 1,444
  • 1
  • 16
  • 28
RCS
  • 1,370
  • 11
  • 27

3 Answers3

4

Unfortunately not. The best that you can do at the moment is to create a property which concatenates the properties that you want to uniquely identify and put a constraint on that.

Brian Underwood
  • 10,746
  • 1
  • 22
  • 34
  • The answer to [this somewhat related question](http://stackoverflow.com/questions/22498054/how-to-create-unique-constraint-involving-multiple-properties-in-neo4j) provides a suggestion for how to concatenate. – cybersam Jan 28 '16 at 21:38
4

You can use an array property and create index on that.

František Hartman
  • 14,436
  • 2
  • 40
  • 60
0

As of now, neo4j(v3.0.3) still does not support unique constraint with multiple properties. The reason behind this is: When a unique constraint is created it also creates an index on it and as indexes only allow one property, thus constraints can only be applied on one index.

piyush121
  • 496
  • 11
  • 16