i want to handle dynamic query string in Arangodb
let condition = 'FILTER u.username == '+value
if(usingPhoneNumber){
condition = 'FILTER u.phoneNumber == '+value
}
const query = aql`
FOR u in users
${condition}
RETURN u
`
if I do like this, I'm getting error like
ArangoError: AQL: syntax error, unexpected bind parameter near '@value0
we can pass aql query into another aql query
let condition = aql`FILTER u.username == ${value}`
if(usingPhoneNumber){
condition = aql`FILTER u.phoneNumber == ${value}`
}
const query = aql`
FOR u in users
${condition}
RETURN u
`
this fixes my issue. thank guys for your answers