File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ const mongoose = require ( 'mongoose' ) ;
2+ const { ObjectId} = mongoose . Schema ;
3+
4+ const BlogSchema = new mongoose . Schema (
5+ {
6+ title : {
7+ type : String ,
8+ trim : true ,
9+ min : 5 ,
10+ max : 150 ,
11+ required : true
12+ } ,
13+ slug : {
14+ type : String ,
15+ unique : true ,
16+ index : true
17+ } ,
18+ body : {
19+ type : { } ,
20+ required : true ,
21+ min : 300 ,
22+ max : 3000000
23+ } ,
24+ excerpt : {
25+ type : String ,
26+ max : 1000
27+ } ,
28+ mtitle : {
29+ type : String
30+ } ,
31+ mdesc : {
32+ type : String
33+ } ,
34+ photo : {
35+ data : Buffer ,
36+ contentType : String
37+ } ,
38+ categories :[ { type : ObjectId , ref :"Category" , required :true } ] ,
39+ taglists :[ { type : ObjectId , ref :"Tag" , required :true } ] ,
40+ postedBy :{
41+ type : ObjectId ,
42+ ref :"Users"
43+ }
44+ } ,
45+ { timestamps : true }
46+ ) ;
47+
48+ module . exports = mongoose . model ( 'Blog' , BlogSchema ) ;
You can’t perform that action at this time.
0 commit comments