arangodb/arangojs

How to debug aql-template queries?

tonn opened this issue · 1 comments

tonn commented

Usually I copy query to/from arangodb web interface for testing. It works with old-style binding. But for aql-templates I have to convert query and it becomes completely unusable.
Maybe there is auto converter for aql-templates? Or other way to debug queries?

If you want to use regular AQL syntax, you can pass a regular (raw) query string instead of an AQL template strings. Note that you will have to handle the bindVars object yourself and make sure to correctly indicated @collection parameters. The API documentation shows examples for both variants as overloaded methods.

Personally I copy the queries from my JS/TS code as-is and replace the ${arg} template syntax with hardcoded values during manual experimentation. This can get tedious when dealing with lots of bind parameters of course.

Note that this syntactical difference is imposed by JavaScript, not arangojs, so there's no way to make AQL template strings look like raw AQL query strings.