blob: 70b4e7aaccd181ed103906fe0bb3e28f3c8b4380 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
|