title: How to use $in in mongoose reference schema
body: <p>I have 2 schemas 1st is city and second is pincode. Pincode having reference of city. They both look like this</p>
  
  <p><strong>CITY schema</strong></p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  // create a all city list
  var allCitySchema = new Schema({
      cities: {
        type: String
      }
  }, {collection: 'allcities'});
  
  var allcities = mongoose.model('allcities', allCitySchema);
  module.exports = allcities;
  </code></pre>
  
  <p><strong>Pincode schemas</strong> </p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  var allPincode = new Schema({
      city_id: {
          type: Schema.ObjectId,
          ref: 'allcities'
      },
      pincode: {
          type: String
      }
  }, {collection: 'pincode'});
  
  var allPincode = mongoose.model('pincode', allPincode);
  module.exports = allPincode;
  </code></pre>
  
  <p>Now the problem is when  i tried to fetch all pincode based upon city id for that i tries like this</p>
  
  <pre><code> app.post('/api/getPincodeByCity', function(req, res) {
          console.log("In pincode");
          var cities_id = [];
          cities_id = req.body.cities_id;
          console.log(req.body); // { cities_id: '["5597aa08c0a0beb40be128d4","5597aa2bbb18fefc142b6915"]' }
          console.log(cities_id);
          pincodes.findById( {city_id: { $in: cities_id }}, function(err,pincodeIds){
              if(err) res.send(err.message);
               res.send(pincodeIds);
               res.end('{"success" : "Recieved Successfully", "status" : 200}');
          });
      });
  </code></pre>
  
  <p>But it's not working its giving me this error</p>
  
  <pre><code>Cast to ObjectId failed for value "[object Object]" at path "_id"
  </code></pre>
  
  <p>I also try with <code>find()</code> instead of <code>findById()</code> method but it giving me this error</p>
  
  <pre><code>undefined is not a function
  </code></pre>