I am trying to do schema validation in mongoose of type object and array, but I am not able to do that. Here is the schema:
var alertEmailSchema = new alertEmailSchema({
templateId: { type: String, required: true,unique: true},
templateName : { type: String, required: true},
status: Boolean,
frequency : { type: Object, required: true},
recipientsEmailId : { type: [String], default: [], required: true},
subject : { type: String, required: true},
message : { type: String, required: true},
description : String,
createdDate : {type : Date, default : Date.now},
updatedDate : {type : Date, default : Date.now}
});
var schemaValidation = newAlertEmail.validateSync();
Please tell me how can I do the validation for this.
via Anita Mehta
No comments:
Post a Comment