constraints - Neo4j Client: Can we throw an exception if there are already maxium number of relationship reached? -
if have 1 many relationship 1 vehicle has 1 4 wheels, if try call
graphclient.create(wheel, new vehiclehaswheel(vehicle.reference));
can expect graphclient throw exception don't have 5 wheels on car?
we can define maxium number 4 relationship carhaswheel.
right if have check constrain need manaully query database existing wheels decide whether should create one.
neo4j not provide these types of constraints in box, doesn't have way specify schema that.
you achieve similar solution doing mutations via cypher queries though:
start ... ... create ...
that integrates 2 queries (decide, mutate) one.
to know if created or not, return it:
start ... ... create ... return ...
Comments
Post a Comment