尝试进行位置更新时出现以下错误
cannot use the part (items of items.$[].notes) to traverse the element ({items: [ { is_confirm: false, status: \"50\", _id:
我正在运行link之后的代码
await Order.updateOne(
{ _id: id },
{
$set: {
'items.$[].status': Status.ORDER_PLACED
},
$push: {
'items.$[].notes': { message: 'Order placed' }
}
},
{ new: true }
);
这是我的数据模型
{
"_id" : ObjectId("5dde925780ae25454af211a8"),
"items" : [
{
"is_confirm" : false,
"status" : "50",
"_id" : ObjectId("5dde925780ae25454af211a9"),
"images" : [],
"product_id" : ObjectId("5ddd767550785c3620047efe"),
"variant_id" : "",
"quantity" : 1,
"product_name" : "Amazfit Bip Lite Smart Watch (Black)",
"discount_percentage" : 28,
"regular_price" : 1250,
"sale_price" : 900,
"shop_id" : ObjectId("5dbc2c19cc1a7b76aa7e713f"),
"variant_name" : "",
"features" : [],
"notes" : []
}
]
"__v" : 0
}