diff --git a/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js b/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js index cde4ee3ac8..ef003d0a06 100644 --- a/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js +++ b/js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js @@ -1891,7 +1891,10 @@ var bindVertexCollections = function(self, vertexCollections) { wrap.remove = function(vertexId, options) { //delete all edges using the vertex in all graphs var graphs = getGraphCollection().toArray(); - var vertexCollectionName = vertexId.split("/")[0]; + var vertexCollectionName = key; + if (vertexId.indexOf("/") === -1) { + vertexId = key + "/" + vertexId; + } self.__collectionsToLock.push(vertexCollectionName); graphs.forEach( function(graph) { diff --git a/js/common/modules/org/arangodb/general-graph.js b/js/common/modules/org/arangodb/general-graph.js index 378e77e055..873711d338 100644 --- a/js/common/modules/org/arangodb/general-graph.js +++ b/js/common/modules/org/arangodb/general-graph.js @@ -1890,7 +1890,10 @@ var bindVertexCollections = function(self, vertexCollections) { wrap.remove = function(vertexId, options) { //delete all edges using the vertex in all graphs var graphs = getGraphCollection().toArray(); - var vertexCollectionName = vertexId.split("/")[0]; + var vertexCollectionName = key; + if (vertexId.indexOf("/") === -1) { + vertexId = key + "/" + vertexId; + } self.__collectionsToLock.push(vertexCollectionName); graphs.forEach( function(graph) { diff --git a/js/common/tests/shell-general-graph.js b/js/common/tests/shell-general-graph.js index 1a639e896c..6909ffa126 100644 --- a/js/common/tests/shell-general-graph.js +++ b/js/common/tests/shell-general-graph.js @@ -1979,8 +1979,8 @@ function EdgesAndVerticesSuite() { var myED = "unitTestEdgeCollection4711"; var myVD1 = "unitTestVertexCollection4711"; var myVD2 = "unitTestVertexCollection4712"; - try {graph._drop(myGraphName, true)} catch (ignore){} - try {db._drop(myED)} catch (ignore){} + try {graph._drop(myGraphName, true);} catch (ignore){} + try {db._drop(myED);} catch (ignore){} try { graph._create( myGraphName, @@ -2045,9 +2045,24 @@ function EdgesAndVerticesSuite() { }, test_vC_remove : function () { - var vertex = g[vc1].save({first_name: "Tim"}); + var col = g[vc1]; + var counter = col.count(); + var vertex = col.save({first_name: "Tim"}); + assertEqual(col.count(), counter + 1); var vertexId = vertex._id; - var result = g[vc1].remove(vertexId); + var result = col.remove(vertexId); + assertEqual(col.count(), counter); + assertTrue(result); + }, + + test_vC_remove_by_key : function () { + var col = g[vc1]; + var counter = col.count(); + var vertex = col.save({first_name: "Tim"}); + assertEqual(col.count(), counter + 1); + var vertexId = vertex._key; + var result = col.remove(vertexId); + assertEqual(col.count(), counter); assertTrue(result); }, @@ -2143,6 +2158,19 @@ function EdgesAndVerticesSuite() { assertTrue(edge); }, + test_eC_remove_by_key : function () { + var vertex1 = g[vc1].save({first_name: "Tom"}); + var vertexId1 = vertex1._id; + var vertex2 = g[vc1].save({first_name: "Tim"}); + var vertexId2 = vertex2._id; + var counter = g[ec1].count(); + var edge = g[ec1].save(vertexId1, vertexId2, {}); + assertEqual(g[ec1].count(), counter + 1); + var edgeId1 = edge._key; + edge = g[ec1].remove(edgeId1); + assertTrue(edge); + assertEqual(g[ec1].count(), counter); + }, test_eC_removeWithEdgesAsVertices : function () {