-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathproductSchema.js
62 lines (60 loc) · 1.38 KB
/
productSchema.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const mongoose = require("mongoose")
const productSchema = mongoose.Schema(
{
productName: {
type: String
},
price: {
mrp: {
type: Number
},
cost: {
type: Number
},
discountPercent: {
type: Number
}
},
subcategory: {
type: String
},
productImage: {
type: String
},
category: {
type: String
},
description: {
type: String
},
tagline: {
type: String
},
quantity: {
type: Number,
default: 45
},
reviews: [
{
rating: {
type: Number,
},
comment: {
type: String,
},
reviewer: {
type: mongoose.Schema.Types.ObjectId,
ref: "CUSTOMERS",
},
date: {
type: Date,
default: Text,
},
},
],
seller: {
type: mongoose.Schema.Types.ObjectId,
ref: 'seller'
},
}, { timestamps: false});
module.exports = mongoose.mongoose("product", productSchema)