name: aaaa shirts
category: shirts
subcategory: [{
type: slimline,
model: [{
\"type\": \"twill\",
\"colour\": [{
@Ratan Uday Kumar's answer is right, but another but similar way is:
var ProductSchema = new mongoose.Schema({
category :{type:String},
name :{type:String},
description :{type:String},
type :[{type:String}],
fabric :[{type:String}],
size :[{type:Number}],
color :[{type:String}],
created_at :{ type: Date },
updated_at :{ type: Date, default: Date.now },
updated: {type: Date, default: Date.now}
}, { versionKey: false }, {strict: false});
export default mongoose.model('Product', ProductSchema);
{strict: false} is for future! How? Now your schema has 10 fields, if in future you want to add an object with 12 (anything more than 10), you can do it, because there is no strictness in inserting objects with these 10 fields. Even if less fields.