Reputation: 135
In ArangoDB, I'have a graph with two Vertexs(Users and Devices) one Edge(User Device Relation). With one User and one Device there can only be one Relation, so the Edge's key is fixed like "{User Key}_{Device Key}". My questions are:
Upvotes: 0
Views: 407
Reputation: 263
Is there a single command can create a new edge if not exist and replace one if already exist?
No unfortunately not, you would first have to look up the edge and update/create if needed.
With Java driver, what is the equal method of "collection.exists(document)"?
Which Java driver are you using ? If you are using this one (the one we recommend) you could use
checkDocument
but you have to surround it with a try catch and check if you receive a 404 error code :
try {
driver.checkDocument(collectionName, documentKey);
fail();
} catch (ArangoException e) {
assertThat(e.getCode(), is(0));
assertThat(e.getErrorNumber(), is(404));
}
Upvotes: 1