1

Since user-functions are not allowed to have side-effects with respect to the data, I wondered if it's possible to call one function from the other.

I want to factor out common calculations.

One possible way I see is to use

var result = db._query("RETURN myfuncs::func(@a1, @a2)",
                       {'@a1': 'val1', '@a2': 'val2}, null, null).next();

But I would like another way if possible.

2 Answers 2

2

Each user function is completely standalone, meaning it is not possible to call a user function from within another.

This might change in the future, but this is the situation at the moment (ArangoDB 2.3/2.4/2.5).

Sign up to request clarification or add additional context in comments.

2 Comments

That's unfortunate for our use case. I will make do with the db aproach
Just for the record: The db-way helped a lot during prototyping, now everything is ported to foxx.
1

I found the way how to do this. You can use db._query in user function, i.e.

var db = require('internal').db;
var resultFromOtherUserFunc = db._query('RETURN userFunction::MyFunction(@param)', {param: true}).toArray();

1 Comment

That Solution/workaround is actually mentioned in my question ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.