0
votes

I'm new to ArangoDB, created two Document Collections

Account

enter image description here

Payments

enter image description here

How to create edge collection like enter image description here

I can't go through one by one record and add _from and _to, the number of records is huge,

Need 3 nodes for Account, Customer and TrxID

Should link based on the values between two Document Collection.

May i know any documentation or sample code

1

1 Answers

0
votes

first let me answer you initial question and then provide a tip for your use case.

You are right, that both nodes and edges are full JSON documents in ArangoDB but you have to import edges into a special edge collection. If you are using arangoimport for creating edges, you can use the following command as one

arangoimport --file path to the file on your machine --collection your collection name --create-collection true --type csv --create-collection-type edge

If the collection does not yet exist, use 'create collection true', if the collection already exists you don't need to specify this and just leave it out. Please make sure, that all your edges do have a _from and _to attribute which are the IDs of the nodes the edge connects. ArangoDb will then automatically create the edge index using _from and _to.

About your example: I guess it is a kind of fraud or money laundering example. With other graph databases you might get the recommendation to use transactions as your nodes and accounts/customer and cparty as your edges. With ArangoDB, you could do the opposite and use transactions as your edges. You have full blown JSON documents also as edges and can store arbitrary data there. Could be more intuitive and natural to see your data that way. In addition, you can see your edge collection also as normal document collections and perform aggregations, joins or any other access pattern you see necessary.

UPDATE: From my understanding of your data model a bank transaction goes from AccountNo of the sending party (_from) to the CounterpartyAccID of the receiving part (_to). These two properties should become your _from and _to attributes of an edge which has to be stored in an edge collection together with the rest of the transaction details like TrxID and Transaction amount. You can create an edge collection also via the ArangoDB WebUI in the Collections tab on the left.

Not sure if this here helps with large amounts of data but you could have a look at creating Edges with AQL here: https://www.arangodb.com/docs/stable/aql/tutorial-traversal.html#creating-the-edges We are working on more tutorials on creating edges but no ETA yet

Hope I could help a bit,

Best, Jan