product.js 439 B

123456789101112131415
  1. const mongoose = require('mongoose')
  2. const Schema = mongoose.Schema
  3. const ProductSchema = new Schema({
  4. category: { type:Schema.Types.ObjectId, ref: 'Category' },
  5. owner: { type:Schema.Types.ObjectId, ref: 'Owner' },
  6. title: String,
  7. description: String,
  8. photo: String,
  9. price: Number,
  10. stockQuantity: Number,
  11. rating: [{ type:Schema.Types.ObjectId, ref: 'Review' }]
  12. })
  13. module.exports = mongoose.model('Product', ProductSchema)