aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2021-05-03 18:53:54 +0200
committerMateja <mail@matejamaric.com>2021-05-03 18:53:54 +0200
commitbae6d329c44701755c85fb64e9b885c907897a88 (patch)
treebd3e3458d101fb2a62e1568e25954d37c16e7399
parentafada334b97859106c4f320e1e529358fec7a216 (diff)
downloadnode-playground-bae6d329c44701755c85fb64e9b885c907897a88.tar.gz
node-playground-bae6d329c44701755c85fb64e9b885c907897a88.zip
Add `date` to `post` model.
-rw-r--r--models/post.js3
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);