From 82a6eea0de45ef7d9768779dc7c32d0d09a3e3a9 Mon Sep 17 00:00:00 2001 From: Mateja Date: Tue, 4 May 2021 21:27:52 +0200 Subject: Make `title` and `text` required in `Post` model. --- models/post.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'models') diff --git a/models/post.js b/models/post.js index af53543..8227c85 100644 --- a/models/post.js +++ b/models/post.js @@ -1,8 +1,8 @@ const mongoose = require('mongoose'); const postSchema = new mongoose.Schema({ - title: String, - text: String, + title: {type: String, required: true}, + text: {type: String, required: true}, date: {type: Date, default: Date.now} }); -- cgit v1.2.3