问题描述
NetworkRequest
const reviewSchema = new mongoose.Schema(
{
user: { type: mongoose.Schema.Types.ObjectId,ref: "User",required: true },comment: { type: String,rating: { type: Number,},{
timestamps: true,}
)
const productSchema = new mongoose.Schema(
{
name: { type: String,required: true,unique: true },price: { type: Number,isVisible: { type: Boolean,default: false },description: { type: String },shortDescription: { type: String },image: { type: String },labels: { type: Array,default: [] },category: {
type: mongoose.Schema.Types.ObjectId,ref: "Category",required: false,rating: { type: Number },numReviews: { type: Number,default: 0 },reviews: [reviewSchema],}
但我得到了错误;
const product = await Product.findById(req.params.id).populate(
"review.user name id"
)
if (product) {
res.send(product)
谢谢:)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)