const mongoose = require("mongoose"); const reviewSchema = new mongoose.Schema({ name: { type: String, required: [true, "Review must have a name"], }, text: { type: String, required: [true, "Review must have a text"], }, date: { type: Date, default: Date.now(), }, email: { type: String, required: [true, "Review must have a email address"], select: false, }, blog: { type: mongoose.Schema.ObjectId, ref: "Blog", required: [true, "Each review must have a blog id"], }, }); const Review = mongoose.model("Review", reviewSchema); module.exports = Review;