To kick things off, let's customize how Mongoose treats our text property. Currently, we tell Mongoose that we want it to be a string, but we don't have any validators. One of the first things we can do for the text property is set required equal to true.
var Todo = mongoose.model('Todo', { text: { type: String, required: true },
When you set required equal to true, the value must exist, so if I were to try to save this Todo it would fail. And we can prove this. We can save the file, head over to the Terminal, shut things down, and restart it:
We get an unreadable error message. We'll dive into this in a ...