aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2021-05-04 21:27:52 +0200
committerMateja <mail@matejamaric.com>2021-05-04 21:27:52 +0200
commit82a6eea0de45ef7d9768779dc7c32d0d09a3e3a9 (patch)
tree92c4da17d65497dfc1c1eddd67319a23251e3422
parentbae6d329c44701755c85fb64e9b885c907897a88 (diff)
downloadnode-playground-82a6eea0de45ef7d9768779dc7c32d0d09a3e3a9.tar.gz
node-playground-82a6eea0de45ef7d9768779dc7c32d0d09a3e3a9.zip
Make `title` and `text` required in `Post` model.
-rw-r--r--models/post.js4
1 files changed, 2 insertions, 2 deletions
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}
});