Closed Arun-KumarH closed 6 years ago
Since arangojs just uses the HTTP API, this sounds like a bug in ArangoDB, not arangojs. The code you have posted here seems to correctly use the GraphEdgeCollection
, which uses the graph API to save documents.
Can you please create an issue at https://github.com/arangodb/arangodb/issues/new and reference this one in it?
@pluma Does arangojs wrap the Gharial API, or does it use the document API for this?
@Simran-B As I said, it uses the graph API (i.e. gharial).
Thanks for the clarification. I wasn't sure if there's another graph API that would allow you to create edges, because we do have other graph-related endpoints, but this one here is for querying only and points you to the normal document endpoints for CRUD: https://docs.arangodb.com/devel/HTTP/Edge/WorkingWithEdges.html
@Simran-B That is why I clarified it. Regular EdgeCollection
uses the regular edge API. But the code example uses graph.edgeCollection
which returns a GraphEdgeCollection
.
This is the route GraphEdgeCollection#save
uses:
/_api/gharial/${this.graph.name}/edge/${this.name}
To clarify: I'm assuming graph
is indeed a Graph, not a Database.
Works with DB version 3.3.9.
Hello,
I have created a vertex collection named 'vertices' and created an edge named ('vertice_to_vertice_edge') between the 'vertices' collection. I inserted two vertices (with keys 1 and 2) and created and edge between them.
// Valid Edge created await createEdge('vertice_to_vertice_edge', {some: 'edgeData1'}, 'vertices/1', 'vertices/2');
// Invalid Edge should not have been created await createEdge('vertice_to_vertice_edge', {some: 'edgeData2'}, 'vertices/3', 'vertices/4');
If I try to create one more edge between vertex keys (3 and 4) the edge still gets created although the vertices 3 and 4 does not exist ? Is this the expected behaviour ? (I can post the code snippet if needed to reproduce).
Thank you.