diff options
author | Mateja <mail@matejamaric.com> | 2021-05-04 21:27:52 +0200 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2021-05-04 21:27:52 +0200 |
commit | 82a6eea0de45ef7d9768779dc7c32d0d09a3e3a9 (patch) | |
tree | 92c4da17d65497dfc1c1eddd67319a23251e3422 /models | |
parent | bae6d329c44701755c85fb64e9b885c907897a88 (diff) | |
download | node-playground-82a6eea0de45ef7d9768779dc7c32d0d09a3e3a9.tar.gz node-playground-82a6eea0de45ef7d9768779dc7c32d0d09a3e3a9.zip |
Make `title` and `text` required in `Post` model.
Diffstat (limited to 'models')
-rw-r--r-- | models/post.js | 4 |
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} }); |