title: how to compare the value of a key-value pair from an array in mongoose and retrieve it
body: <p>I have data for batch collection which looks like this:</p>
  
  <pre><code>[
    {
      "_id": "58d21104a2b6940fd99db632",
      "username": "58d18698669fd20ea0b81720",
      "batchname": "dynamic",
      "time": "21:20",
      "activityname": "dance",
      "eventtype": "demo",
      "duration": 50,
      "price": "120$",
      "__v": 0,
      "trainer": [
        {
          "trainername": "ramu",
          "_id": "58d21104a2b6940fd99db633"
        }
      ]
    },
    {
      "_id": "58d226eb5f73f7150ffc3181",
      "username": "58d18698669fd20ea0b81721",
      "batchname": "spck",
      "time": "21:20",
      "activityname": "dance",
      "eventtype": "demo",
      "duration": 50,
      "price": "120$",
      "__v": 0,
      "trainer": []
    },
    {
      "_id": "58d22745079e481533f23bbe",
      "username": "58d18698669fd20ea0b81721",
      "batchname": "spctygytgyk",
      "time": "21:20",
      "activityname": "music",
      "eventtype": "demo",
      "duration": 50,
      "price": "120$",
      "__v": 0,
      "trainer": [
        {
          "trainername": "siva",
          "_id": "58d22745079e481533f23bbf"
        }
      ]
    }
  ]
  </code></pre>
  
  <p>In that I want to retrieve the details of the batch whose activityname matches with parameter send in the url. I have written the code as:</p>
  
  <pre><code>batchrouter.route('/activity/:activityName')
  .get(Verify.verifyOrdinaryUser,function (req, res, next) {
   Batch.find({"activityname":"req.params.activityName"}, function (err, batch) {
          if (err) throw err;
          res.json(batch);
      });
  });
  </code></pre>
  
  <p>when executing the route as <code>localhost:3000/batch/activity/dance</code> it is returning an empty array as <code>[]</code>. How to modify the code so as i want to retrieve the batch details when the activityname is dance. I am new to mongodb and mongoose. Please help me.</p>