title: Generate mongoose DTO for MEAN application
body: <p>I am new to mongoose and node and I am building an application using the MEAN stack (Mongo ExpressJS AngularJS Node).</p>
  
  <p>I have built a lot of APIs in the past using asp.net WebAPI, and I can't find any documentation on the use of DTO or View Models, in order to reduce the volume of JSON transfered back and forth between my server and my front end.</p>
  
  <p>My application is about a survey that users fill online. Each answers is then used to produce a score by user. </p>
  
  <p>My models:</p>
  
  <pre><code>var UserSchema = new Schema({
      email: {type: String, trim: true,default: '', match: [/.+\@.+\..+/,'']},
      status: {type: String},
      token:{type: String, default: crypto.randomBytes(64).toString('hex')},
      score: {
          managementExperience: {type: Number},
          managementSkills: {type: Number},
          relevantKnowledge: {type: Number},
          commitment: {type: Number},
          acceptanceOfChange: {type: Number},
          age: {type: Number},
          totalScore: {type: Number}
      },
      answers: [
          {
              optionId: {type: Schema.Types.ObjectId}
          }
      ]
  });
  
  var SurveySchema = new Schema({
      client_id:{type: Schema.Types.ObjectId, ref: 'Client' },
      creationDate:{type: Date,default: Date.now},
      title: {type: String, trim: true},
      surveyVersion: { type: Schema.Types.ObjectId, ref: 'SurveyVersion' },
      users:[UserSchema]
  });
  </code></pre>
  
  <p>The survey screen itself works, but when it comes to produce a dashboard of the results, I would like to send a DTO and not the whole SurveySchema, like this model:</p>
  
  <pre><code>var SurveySchemaLight = new Schema({
      client_id:{type: Schema.Types.ObjectId, ref: 'Client' },
      creationDate:{type: Date,default: Date.now},
      title: {type: String, trim: true},
      users:[{
          email: {type: String, trim: true,default: '', match: [/.+\@.+\..+/,'']},
          status: {type: String}
      }]
  });
  </code></pre>
  
  <p>In .Net world I would have this model to have a constructor that takes as parameters an instance of SurveySchema, but I can't find a way to make it work.</p>
  
  <p>I also tried to have both Schemas linked to the same collection in mongodb:</p>
  
  <pre><code>mongoose.model('Survey', SurveySchema);
  mongoose.model('SurveyLight', SurveySchemaLight, 'surveys');
  </code></pre>
  
  <p>But when I run the following query on SurveyLight schema, I still have all the fields from Survey returned:</p>
  
  <pre><code>SurveyLight.find({'client_id': req.params.clientID}).exec(function(err, surveyList){
          res.json(surveyList);
      });
  </code></pre>
  
  <p>What would be the best practices to have a DTO/View Model mechanism in my stack?</p>
  
  <p>Thanks</p>