title: Adding field to schema using mongoose in node js
body: <p>I am trying to write a schema that takes the parameters required by an activity. I am want to add a field 'activityParameters' that will be case specific depending on the activityType. Suppose if the activityType is email then the activityParameters should store details like'to:String, from:String, subject: String, body: String' and if the activity is "export" then it should store parameters like 'path:String' . Different types of activity will have different parameters. Please help me how to do this.</p>
  
  <pre><code>var activity_type = {
    values: 'email export'.split(' '),
    message: 'validation failed for path `{PATH}` with value `{VALUE}`'
  };
  var activitySchema = new Schema({
    activityName: String,
    activityDescription: String,
    executionTime: {type: Date , default: null},
    activityStartTime: {type: Date , default: null},
    activityCompletionTime: {type: Date , default: null},
    activityType: {type:String, enum: activity_type},
    //activityParameters: ,
    appName : String,
    activityRetryCount: {type:Number,default:0},
    createdOn: {type:Date , default:Date.now},
    deletedOn: {type: Date , default: null},
    updatedOn: {type: Date , default: null}
  </code></pre>
  
  <p>});</p>