title: Mongoose find result and then replace field with findOne
body: <p>I am new to mongodb and come from relational database, and without join it's kind pain for me to go on with mongodb.</p>
  
  <p>What i want to archive here is getting all the projects and update the projectType with proper project type name rather with project type id. Somehow the projects.attrubtes just can't be overwrite. then i tried the following post. with no luck. any help is appreciated. anyone can give me some guide would be much appreciated.</p>
  
  <p><a href="https://stackoverflow.com/questions/14504385/why-cant-you-modify-the-data-returned-by-a-mongoose-query-ex-findbyid">Why can&#39;t you modify the data returned by a Mongoose Query (ex: findById)</a></p>
  
  <pre><code>var _ = require('lodash');
  var project = require('./project.model');
  var Form = require('../form/form.model');
  
  // Get list of projects
  exports.index = function(req, res) {
    project.find(function (err, projects) {
      if(err) { return handleError(res, err); }
  
      _.each(projects, function(element, index){
        Form.findOne({_id : projects[index].projectType}, '-formContent -_id -createdDateTime', function(error, form){
  
          if(form !== undefined) projects[index].projectType = form.formName;
        });
      });
  
      return res.json(200, projects);
    }).sort({ createdDateTime: 'desc' });
  };
  </code></pre>