blob: f01431b1336bf81b00313f9ef1d547d80a2446bd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
const mongoose = require('mongoose');
const postSchema = new mongoose.Schema({
title: {
type: String,
required: [true, "You need to provide a title."],
maxLength: [100, "You can't have a title more than 100 characters long."]
},
text: {
type: String,
required: [true, "You need to provide some text."]
},
date: {
type: Date,
default: Date.now
}
});
const postModel = mongoose.model('post', postSchema);
module.exports = postModel;
|