I would like to generate a query dynamically in Foxx. The filter statement would be there or not depend on the request parameter. For example
//Conditionally determine if we should include a filter statement here or not
var var1=true;
getAllEntitiesThatSatisfyTheCondition = db._query(aql `
For u In ${EntityCollection}
${var1 ? `Filter u.prop == ${var1}`:``}
Return DISTINCT u._id
`).toArray();
This one would return an error about binding value
syntax error, unexpected bind parameter
How can I construct the query using literal template this way in arango, or I have to use query builder?