title: How can I separate mongoose subdocument into seperate files?
body: <p>In <code>region.server.model.js</code> I want to have</p>
  
  <pre><code>var RegionSchema = new Schema({    
    name: {type: String},
    user: {type: Schema.ObjectId, ref: 'User'},
    bases: [BaseSchema]
  });
  
  mongoose.model('Region', RegionSchema);
  </code></pre>
  
  <p>And in another file named <code>base.server.model.js</code> I want to have</p>
  
  <pre><code>var BaseSchema = new Schema({    
    name: {type: String},
    region: {type: Schema.ObjectId, ref: 'Region'}
  });
  
  mongoose.model('Base', BaseSchema);
  </code></pre>
  
  <p>It is crashing with</p>
  
  <pre><code>bases: [BaseSchema]
          ^    
  ReferenceError: BaseSchema is not defined
  </code></pre>
  
  <p>I cannot figure out how in mean.js to relate or link these two files.</p>
  
  <p>Thank you!</p>