-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblogModel_assignment.js
53 lines (30 loc) · 1.03 KB
/
blogModel_assignment.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// defining a mongoose schema
// including the module
var mongoose = require('mongoose');
// declare schema object.
var Schema = mongoose.Schema;
var blogSchema = new Schema({
title : {type:String,default:'',required:true},
language :{type:String,default:'',required:true},
subTitle : {type:String,default:''},
blogBody : {type:String},
tags : [],// name of tags in array
created : {type:Date},
lastModified : {type:Date},
authorInfo : {} ,// information of author in form of obje-ct
comments :[ {
user_name :{type :String ,required:true},
comment_body:{type:String ,default:''}
}
],
upvotes :{type:Number,default:0},
downvotes:{type:Number,default:0},
fshares:[
{user_name :{type :String ,required:true}}
],
tshares:[
{user_name :{type :String ,required:true}}
],
topFeeds:{}
});
module.exports = mongoose.model('Blog',blogSchema);