title: Mongoose - Child Schema References Parent Subdocument
body: <p>Is it possible to have a Mongoose Schema that resembles the following:</p>
  
  <pre><code>var categorySchema = new Schema({
      name : String
  });
  
  var childSchema = new Schema({
     name : String,
     category : {
        type : Schema.Types.ObjectId,
        ref : 'parent.categories'
     }
  });
  
  var parentSchema = new Schema({
      categories : [categorySchema],
      children : [childSchema]
  });
  </code></pre>
  
  <p>Basically a child can only have a category that is contained by its parent. Is what I am trying to do possible? If not what is the cleanest way to do this?</p>