summaryrefslogtreecommitdiff
path: root/models/blogPost.js
diff options
context:
space:
mode:
Diffstat (limited to 'models/blogPost.js')
-rw-r--r--models/blogPost.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/models/blogPost.js b/models/blogPost.js
new file mode 100644
index 0000000..70b4e7a
--- /dev/null
+++ b/models/blogPost.js
@@ -0,0 +1,24 @@
+const mongoose = require('mongoose');
+
+//Schema Setup
+const blogpostSchema = new mongoose.Schema({
+ title: String,
+ image: String,
+ body: String,
+ tag: String,
+ author: {
+ id: {
+ type: mongoose.Schema.Types.ObjectId,
+ ref: 'User'
+ },
+ username: String
+ },
+ comments: [
+ {
+ type: mongoose.Schema.Types.ObjectId,
+ ref: 'Cmmnt'
+ }
+ ]
+});
+
+module.exports = new mongoose.model('Post', blogpostSchema);