I'm trying to implement a review functionality for a simple event app I'm developing. I want that the users who attended to an event give feedback to the organizer of the event. I have an organizer schema, and I want to store the ObjectId of the user who gave the feedback, the feedback itself, and optional photo uploads. how do I model this in the Organizer schema? Thanks a lot!
Organizer Schema
const mongoose = require('mongoose')
const organizerSchema = mongoose.Schema(
{
username: {
type: String,
required: [true, 'Please add a username'],
unique: true
},
email: {
type: String,
required: [true, 'Please add an email'],
unique: true,
},
password: {
type: String,
required: [true, 'Please add a password'],
},
language: {
type: String,
default: "English"
},
images:[{data:Buffer,contentType: String}],
profilePic: [{data:Buffer, contentType:String}],
status: String,
events:[{ type: mongoose.Schema.Types.ObjectId, ref: 'Event' }],
reviews: [?]
},
{
timestamps: true,
}
)
module.exports = mongoose.model('Organizer', organizerSchema)