Javascript 如何更新节点js和mongoose中的对象数组和对象数组
我想更新我的应用程序,这是有点难以更新。架构看起来像数组和对象内部的数组和对象 例如,模式在产品数组中有一个存储数组,我想更新产品状态,即存储和产品数组中的产品状态 我如何能更新这些模式任何机构帮助提前感谢 这是我的模式Javascript 如何更新节点js和mongoose中的对象数组和对象数组,javascript,node.js,Javascript,Node.js,我想更新我的应用程序,这是有点难以更新。架构看起来像数组和对象内部的数组和对象 例如,模式在产品数组中有一个存储数组,我想更新产品状态,即存储和产品数组中的产品状态 我如何能更新这些模式任何机构帮助提前感谢 这是我的模式 stores: [{ store_name: String, store_category: String, bill_image: {type: String}, total_amount: {type: Num
stores: [{
store_name: String,
store_category: String,
bill_image: {type: String},
total_amount: {type: Number},
notes: [{description: {type: String}}],
store_status: {type: Number, default: 0},//0: pending; 1: start pickup; 2: Arrive for pickup
store_address: {
address: { type: String },
title: { type: String },
lat: { type: String },
lng: { type: String }
},
products: [{
product_name: { type: String },
product_image_url: { type: String, default: null },
product_description: { type: String },
product_qty: { type: Number },
product_unit: { type: String },
procurement_status: { type: String, default: 0 }//0 pending, 1 purchased, 2 unavailable, 3 delivered
}]
}]
这是我的要求
{
booking_id: "30384023808"
stores : [
{
_id:"79734297492394237",
products: [
{
_id:"53453547457",
procurement_status: true
},
{
_id:"e242235465757",
procurement_status: false
}
]
},
{
_id:"56456564434343",
products: [
{
_id:"6565756756756",
procurement_status: true
}
]
}
]
}