0
我正在使用MongoDb和Mongoose为实践电子商务网站创建模型。以下是我迄今为止对我的产品型号:如何在Mongoose模型中添加不同尺寸的产品?
var mongoose = require('mongoose');
module.exports = mongoose.model('Product',{
imagePath: {type: String, required: true},
title: {type: String, required: true},
description: {type: String, required: true},
price: {type: Number, required: true}
});
我的问题是说我有有不同的大小的选项,如S,M衬衫,和L.什么是添加这个最好的方法是什么?另外,如果我包含库存跟踪,我将如何跟踪所有尺寸?在此先感谢和任何和所有帮助表示赞赏。