title: Passing parameters to db.query with arangojs
body: <p>I'm  having problems sending parameters with the ArangoJS library and was wondering if anyone could help.</p>
  
  <p>With the example below, it is possible to execute db.query if parameter values are in the query, but as soon as I try to use bindVars I get silent errors and I can't extract any error details.</p>
  
  <pre><code>var db = require('arangojs')("http://127.0.0.1:8529");
  
  /*
  The '_system' database contains a collection called 'test' that contains one document:
   {
     "a": 1,
     "b": 2
   }
   */
  
  // This works
  db.query('FOR t IN test FILTER t.a == 1 RETURN t')
    .then((cursor) =&gt; {
      cursor.all()
        .then(vals =&gt; {
          console.log("\nNo bindVars");
          console.log(vals);
        });
    });
  
  // This does not work
  db.query("FOR t IN @first FILTER t.a == @second RETURN t", { first: "test", second: 1 })
    .then((cursor) =&gt; {
      cursor.all()
        .then(vals =&gt; {
          console.log("\nUsing bindVars");
          console.log(vals);
        });
    });
  </code></pre>
  
  <p>I'm new to Node.js and ArangoDB and would love to be able to use properly parameterized queries.</p>
  
  <p>I'm also assuming that this use of parameters protects you from SQL Injection style attacks?</p>
  
  <p>Thanks!</p>