Hey developer i am pretty new to mongodb need your help guys shall be thankfull to you!
Problem is that i am creating hair wig website there is product order page where the user have choice to select multiple options if if any of option does not match to product that option will remain off
i had created a schema according to my approach need suggestion
**Hint *** one product has hundred variants like some product has full options and some has not
i am sharing my order page image that what i want to accomplished and also the that i had created
Schema
const productSchema= mongoose.Schema({
title:{
type:String,
required:[true,"Enter product title"]
},
description:{
type:String,
required:[true,"Enter Product description"]
},
StretchedLength:[
{
length:{
type:String
},
quantity:{
type:Number
}
}
],
Density:[
{
amount:{
type:Number
},
quantity:{
type:Number
}
}
],
HairColor:[
{
name:{
type:String
},
quantity:{
type:Number
}
}
],
shipFrom:[
{
location:{
type:String
},
available:{
type:Boolean,
default:false
}
}
],
price:{
type:Number
},
createdAt:{
type:Date,
default:Date.now
},
sale:{
status:{
type:Boolean,
default:false
},
percent:{
type:Number,
default:0
}
},
quantity:{
type:Number
}
})
Order page