var mongoose = require("mongoose");
var Schema = mongoose.Schema;


var contactSchema = new Schema({
  name: String,
  email: String,
  phonenumber: String,
  createdAt: Date
});


var Contact = mongoose.model("Contact", contactSchema);


module.exports = Contact;

@@ -167,16 +167,249 @@
 At: Date
+,%0A  updatedAt: Date%0A%7D);%0A%0A%0AcontactSchema.pre(%22save%22, function(next) %7B%0A  var currentDate = new Date();%0A  if (!this.createdAt) this.createdAt = currentDate;%0A  this.updatedAt = currentDate;%0A%0A  console.log(%22%EC%83%88%EB%A1%9C%EC%9A%B4 %EC%97%B0%EB%9D%BD%EC%B2%98%EA%B0%80 %EC%83%9D%EC%84%B1%EB%90%98%EC%97%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%22);%0A%0A  next();
 %0A%7D);%0A%0A%0Av

update lecture #7: add simple pre hooks - manage createdAt, updatedAt field