I am using pyArango to create edges between two documents using the function
Graph.createEdge()
The problem I am facing is that ArangoDB allows to create duplicate edges with the same _to, _from pair. How to avoid this situation in ArangoDB
This is impossible via some constraint role,
You can avoid it at the insert level:
When creating an edge, use the next query:
UPSERT {_from : @from, _to : @to}
INSERT {_from : @from, _to : @to, label : "knows"}
UPDATE {} IN @@edgeCollection
If there's a match it won't create it (but notice, it will update it so leave the update object empty )
An easy solution is to check before insertion using fetchFirstExample() on the edges collection: