I need to filter some nodes by regex but since Arango v2.8 does not have this functionality I want to try registering user functions can anyone give me an example of how to register a simple function and use it in AQL?
I'm trying:
var myfunc = function (ideation_node) {
for (var i = 0; i < ideation_node.length; ++i) {
if (true) {
return ideation_node[i];
}
}
return null;
}
RETURN myfunctions::myfunc()
You use
triagens/ArangoDb/AqlUserFunctionto register a user function.In AQL-Statements registered functions are used like any other function, using the fully-qualified (i.e. with namespace-prefix) name of the function.
Make sure that the function is side-effect free and don't manipulate input-parameters, but use return-values to pass the calculation results to the outside world.