我需要帮助,我正在尝试更新数组内的数据
content
stage
数组:
{
"_id": ObjectId("5a95b1581ddd0d2c60b90612"),
"country": "Chile",
"name": "Xiaomi",
"start": new Date("2018-02-28T00:00:00-0300"),
"end": new Date("2018-03-03T00:00:00-0300"),
"budget": 5000000,
"instructions": "efaw",
"status": null,
"createdAt": new Date(1519568976029),
"budgetAccum": 2465914.3070999998599,
"brief": {
"stage": [
{
"cantPost": 1,
"cantStories": 1,
"desc": "Descripción",
"title": "Title of etapa",
"_id": ObjectId("5bad2e6814bc8ae0450d79a1"),
"content": [
{
"id": 1,
"desc": "Descripción contenido",
"hashtions": "#hashtag / @mentions",
"media": "photo or video",
"participants": [
],
"type": "post or history",
"title": "Title of contenido"
}
]
}
]
}
}
我的问题是:
const updateContent = await this.update({
"_id": ObjectId(campaignId),
"brief.stage._id": ObjectId(data.id),
"brief.stage.content.id": data.idContent
}, {
"$set": {
"brief.stage.content.$.desc": data.content.desc,
"brief.stage.content.$.hashtions": data.content.hashtions,
"brief.stage.content.$.media": data.content.media,
"brief.stage.content.$.participants": data.content.participants,
"brief.stage.content.$.type": data.content.type,
"brief.stage.content.$.title": data.content.title,
}
});
{
“数据”:{},
“message”:“无法使用部件(阶段简介.阶段.内容.0.desc)遍历元素({stage:[{cantPost:1,cantStories:1,desc:\“Descripcin\”,title:\“title of etapa\”,_id:ObjectId('5bad2e6814bc8ae0450d79a1'),内容:[{id:1,desc:\“Descripcin contendio\”,哈希:\“#hashtag/@notions\”,媒体:\“照片或视频\”,参与者:【】,类型:\“文章或历史\”,标题:\“内容标题\”}]},{cantPost:1,cantStories:1,desc:\“Descripcin\”,title:“title of etapa\”,_id:ObjectId('5bad3932206981e377a1971'),内容:[{hola:\“true\”,adios:\“false\”}]}“,
“name”:“活动引擎”,
“type”:“错误的请求”,
“状态码”:400