title: Passing Node.js parameter into mongodb request
body: <p>I'm working on a simple web service in node.js. I'm using choreographer to route the http calls. This code works fine:</p>
  
  <pre><code>router.get('/search/*', function(req, res, term){
    res.writeHead(200, {'Content Type:':'text/plain'});
    db.collection('foo').find({'a':1}).toArray(function(err, items){
    console.log(items);
      res.write(JSON.stringify(items));
      res.end();
     });
    });
  </code></pre>
  
  <p>As you can see, the find method looks for {'a':1}, this works fine, a record is returned. But when I want to pass the search term from the router to the query I get a null response:</p>
  
  <pre><code>router.get('/search/*', function(req, res, term){
    res.writeHead(200, {'Content Type:':'text/plain'});
    db.collection('foo').find({'a':term}).toArray(function(err, items){
    console.log(items);
      res.write(JSON.stringify(items));
      res.end();
     });
    });
  </code></pre>
  
  <p>Any ideas anyone??</p>
  
  <p>Edit: I have checked the value of term, as suggested below in the comments, it is 1, which is what I expected it to be.</p>