diff options
author | Mateja <mail@matejamaric.com> | 2021-05-03 18:53:54 +0200 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2021-05-03 18:53:54 +0200 |
commit | bae6d329c44701755c85fb64e9b885c907897a88 (patch) | |
tree | bd3e3458d101fb2a62e1568e25954d37c16e7399 | |
parent | afada334b97859106c4f320e1e529358fec7a216 (diff) | |
download | node-playground-bae6d329c44701755c85fb64e9b885c907897a88.tar.gz node-playground-bae6d329c44701755c85fb64e9b885c907897a88.zip |
Add `date` to `post` model.
-rw-r--r-- | models/post.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/models/post.js b/models/post.js index 3f341d1..af53543 100644 --- a/models/post.js +++ b/models/post.js @@ -2,7 +2,8 @@ const mongoose = require('mongoose'); const postSchema = new mongoose.Schema({ title: String, - text: String + text: String, + date: {type: Date, default: Date.now} }); const postModel = mongoose.model('post', postSchema); |