From cc5d2643c026cac1bc55cdddcb08957c73832605 Mon Sep 17 00:00:00 2001 From: Ankit Varshney Date: Sun, 26 Nov 2023 13:24:03 +0530 Subject: [PATCH] added timestamps to reiview --- models/review.js | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/models/review.js b/models/review.js index 93fdba1..92c27ee 100644 --- a/models/review.js +++ b/models/review.js @@ -1,18 +1,23 @@ const mongoose = require("mongoose"); -const reviewSchema = new mongoose.Schema({ - user: { - type: mongoose.Schema.Types.ObjectId, - ref: "User", +const reviewSchema = new mongoose.Schema( + { + user: { + type: mongoose.Schema.Types.ObjectId, + ref: "User", + }, + + rating: { + type: String, + // required: true, + }, + comment: { + type: String, + // required: true, + }, }, - - rating: { - type: String, - // required: true, - }, - comment: { - type: String, - // required: true, - }, -}); + { + timestamps: true, + } +); module.exports = reviewSchema; -// Path: models/course.js \ No newline at end of file +// Path: models/course.js