How do you make Orientdb unique

How to make Edge unique in Orientdb.

The solution I came across:

  • remove edge
  • create it again

but it is not nice. Edge has no properties.

Example:

create edge is_friend from #12:0 to #12:3 

and if I call it again, an error should occur, for example, when you create a unique index.

thanks

enter image description here

+5
source share
1 answer

Create a limit on the Edge out and in the fields. For more information:

http://www.orientechnologies.com/docs/last/orientdb.wiki/Graph-Schema.html#constraints

In your case, try the following:

 CREATE INDEX UniqueEdges ON is_friend (out, in) unique 
+8
source

Source: https://habr.com/ru/post/1210364/


All Articles