I get a validation error with the following message about saving to the database, although I provided all the fields,
{ [ValidationError: Validation failed] message: 'Validation failed', name: 'ValidationError', errors: { Name: { [ValidatorError: Path `Name` is required.] message: 'Path `Name` is required.', name: 'ValidatorError', path: 'Name', type: 'required', value: undefined } } }
This is how the object I'm trying to save looks like
{ Name: 'Nobody Singh', phone: '+919177121364', address: 'flat no 306 koratala apartments\nstreet no 3 ,Himayatnagar, Near Siraj plaza', start: '2014-12-03T13:00:00.000Z', end: '2014-12-03T15:00:00.000Z', details: 'flat no 306 koratala apartments\nstreet no 3 ,Himayatnagar, Near Siraj plaza' }
here is a diagram
// load the things we need var mongoose = require('mongoose'); // define the schema for our user model var appointmentSchema = mongoose.Schema({ email: { type: String, default: ' maisnamraj@gmail.com ' }, name: { type: String, required:true }, phone: { type:Number }, address:{ type: String }, details:{ type: String }, title:{ type: String, default: "Slot Taken"}, start: { type:Date}, end: { type:Date}, requestedDate: { type:Date, default: Date.now } }); // create the model for users and expose it to our app module.exports = mongoose.model('Appointment', appointmentSchema);
Here is the route file
app.post('/saveappointment', function(req, res) { var appointment = new Appointment(); var appointMent = {