Skip to content

Inject bindVar into comment part of an AQL query #848

@matcho

Description

@matcho

Hello, is it possible to achieve something like the following using arangojs : inject a JS variable inside a comment of an AQL query?

For ex:

const myVar = "I'd like to see this in the query string, in a comment";
const query = AQL`
  // FYI: ${myVar} :)
  for doc in coll
    (…)
`;
db.query(query);

Running the code above leads to: Uncaught ArangoError: bind parameter 'value0' was not declared in the query

Tried this too:

const myVar = "// I'd like to see this in the query string, in a comment";
const query = AQL`
  ${myVar}
  for doc in coll
    (…)
`;
db.query(query);

Uncaught ArangoError: syntax error, unexpected bind parameter near '@value0

Thanks,
Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions