text: const mongoose = require('mongoose');
  
  const ReviewSchema = new mongoose.Schema({
      title: {
          type: String,
          required: [true, 'Please add a tilte for the review'],
          trim: true,
          maxlength: 100
      },
      text: {
          type: String,
          required: [true, 'Please add some text']
      },
      rating: {
          type: Number,
          min: 1,
          max: 10,
          required: [true, 'Please add a rating between 1 and 10']
      },
      createdAt: {
          type: Date,
          default: Date.now()
      },
      bootcamp: {
          type: mongoose.Schema.ObjectId,
          ref: 'Bootcamp',
          required: true
      },
      user: {
          type: mongoose.Schema.ObjectId,
          ref: 'Users',
          required: true
      }
  })
  
  //Prevent user from submmitting more than one review per bootcamp
  ReviewSchema.index({bootcamp: 1, user: 1}, { unique: true })
  
  module.exports = mongoose.model('Review', ReviewSchema)