title: how to reference a nested model in another model, mongoose 5.0
body: <p>How to reference a nested model in another model. For example, having this shema, where I want to reference <code>subcategories</code> in <code>User</code> schema:</p>
  
  <pre><code>var UserSchema = Schema({
      publications: [{
      name:String,
      categories: [{
       type: Schema.Types.ObjectId,
       refPath: 'Category.subcategories._id'
      }]
     }]
  });
  </code></pre>
  
  <p>The category contains <code>subcategories</code> as well, and defined as follows:</p>
  
  <pre><code>var CategorySchema = Schema({
      name: String,
      subcategories: [{
          name: String
      }]
  });
  </code></pre>
  
  <p>I am trying to reference <code>subcategories</code> of <code>CategorySchema</code>.</p>