title: Node.js Mongoose and using find with request.params
body: <p>I have two collections stored in a MongoDB: Markers and Pois</p>
  
  <p>MarkerID is a foreign key in Pois and primary key in Markers.</p>
  
  <p>I want to return Pois with a certain Marker ID </p>
  
  <p>I can do this in MongoDB console:</p>
  
  <pre><code>&gt;db.PoiPois.find({"MarkerID":78})
  </code></pre>
  
  <p>I can also do this  with a hardcoded query in a Node.js app using express RESTful routes and Mongoose:</p>
  
  <pre><code>app.get('/pois/:markerid', function(req, res) {
   poiModel.find({MarkerID:78}, function (err,pois) {
          res.contentType('json');
      res.json({
          success: true,
        data: pois
  
      });
   });
  });
  </code></pre>
  
  <p>I want to replace the  hardcoded query with a dynamic one, using the request parameter for markerid so do the following:</p>
  
  <pre><code>poiModel.find({MarkerID:req.params.markerid}, function (err,pois) {
  </code></pre>
  
  <p>but this does not work (returns empty json).</p>
  
  <p>Where am I going wrong? Thanks for any help </p>