title: How to define a nested schema in mongoose?
body: <p>My mongo record is like this:</p>
  
  <pre><code>{
      "_id":{"$oid":"5550b6de437f572112a29f1a"},
      "cv_count":177732,
      "gender_info": {"male_count": 50, "female_count": 32}
      "stability_info_list":[{"ratio":8.802558610369414e-05,"total_count":34081,"years":0},{"ratio":5.868372406912943e-05,"total_count":34081,"years":1}],
      "zhineng_id":"IT Manager"
  }
  </code></pre>
  
  <p>I write the schema like this:</p>
  
  <pre><code>var ZhinengGenderSchema = new Schema({
      male_count: Number,
      female_count: Number
  });
  
  var ZhinengStabilitySchema = new Schema({
      ratio: Number,
      total_count: Number,
      years: Number
  });
  
  var ZhinengStats = new Schema({
      cv_count: Number,
      gender_info: ZhinengGenderSchema,
      stability_info_list: [ZhinengStabilitySchema],
      zhineng_id: String
  })
  </code></pre>
  
  <p>But I got this excetion:</p>
  
  <pre><code>TypeError: Undefined type `undefined` at `gender_info`
  Did you try nesting Schemas? You can only nest using refs or arrays.
  </code></pre>
  
  <p>so <code>mongoose</code> doesn't support nest schemas? But my database has already been there, I cannot change, so how can I define my schema?</p>