29 lines
486 B
JavaScript
29 lines
486 B
JavaScript
const mongoose = require("mongoose");
|
|
const { ObjectId } = mongoose.Schema.Types;
|
|
const blogSchema = new mongoose.Schema({
|
|
title: {
|
|
type: String,
|
|
require: true,
|
|
},
|
|
author: {
|
|
type: ObjectId,
|
|
ref: "Course",
|
|
},
|
|
date: {
|
|
type: Date,
|
|
},
|
|
image: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
body: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
isBookMarked: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
});
|
|
module.exports = mongoose.model("Blog", blogSchema);
|