Search code examples
arangodbarangojs

How to execute generic query in ArangoJs?


I need to execute the following query:

const query = `FOR u IN ${collection} FILTER ${filter} RETURN u`

so that filter variable is generated somehow by me (it is corrects, checked with Arango console)

But

db.query(query)

always returns empty cursor, and

db.query(aql`FOR u IN ${db.collection(collection)} FILTER ${filter} RETURN u`)

ignores my filter - data is not filtered.

How to execute query with arangojs with pre-generated filter?


Solution

  • Fix: db.query(query).all() worked