What is the simplest way to quickly create edges in ArangoDB programmatically?
I would like to create relationships between documents based on a common attribute. I'd like to be able to select an attribute, and for every document in collection A, create an edge to every document in collection B that has the same value in an equivalent attribute.
For example, if I've imported email messages into a collection and people into another collection, I would like to generate edges between the emails and collections. An email's schema might look like this:
{
"_key":
"subject":
"body":
"from":
"to":
}
And a person's schema might look like this:
{
"_key":
"name":
"email":
}
Let's say that the values in the from
and to
fields in the email messages correspond to email addresses that we may find in the people collection.
I'd like to be able to take the collections, attributes, and edge parameters as input, then, for every document in the people collection, create an edge to every document in the email collection that has the same email address in the from
attribute as the current document's email
attribute.
So far, I think that Foxx may be the best tool for this, but I am a bit overwhelmed by the documentation.
Eventually, I'd like to create a full CRUD based on shared attributes between documents defining edges, including an "upsert" equivalent- updating an edge if it already exists and creating it if it doesn't.
I know that doing this with individual API calls with the standard HTTP API would be far too slow, since I would need to query Arango for every document in a collection and return very large numbers of results.
Is there already a Foxx service that does this? If not, where should I start to create one?