【发布时间】:2019-01-23 13:20:59
【问题描述】:
我想在 mongoose 中更新一个值,该值在两个数组中,所以它不起作用。
这是我使用 console.log 访问值的方式。
console.log('MyValue',bestClustering.cluster_importance[0].feature_importance[0].name)
不简单。
这是我更新价值的要求
var value = {
'cluster_importance[0].feature_importance[0].name': 'toto'
}
ClusterImportance.update({
"_id": bestId,
"cluster_importance[0].cluster": clusterNumber
}, {
$set: {
value
}
})
我阅读了适用于一个数组而不是两个数组的 mongoose 文档。任何帮助将不胜感激。
【问题讨论】:
标签: javascript node.js mongoose