title: Mongoose: Set subdocument field value based on parent field value on save
body: <p>This is almost certainly covered elsewhere, but:</p>
  
  <p>If I have a single schema with an embedded sub-document, like so:</p>
  
  <pre><code>var ChildSchema = new Schema ({
  name : {
          type: String, 
          trim: true
  },
  user :{
      type: String, 
      trim: true
  }
  })
  
  var ParentSchema = new Schema ({
  name : {
       type: String,
       trim: true
  },
  child : [ChildSchema]
  })
  </code></pre>
  
  <p>How would I save the name of the ParentSchema to ParentSchema.name and to ChildSchema.name in the same .save() action? The following does not work at all.</p>
  
  <pre><code>ChildSchema.pre('save', function(next){
  this.name = ParentSchema.name;
  next();
  });
  </code></pre>