我有一个这样的数据集:
{
name : 'Doc Name',
photos: [
{
name: 'photo1',
url: 'http://.....'
},
{
name: 'photo2',
url: 'http://......'
}
],
etc ...
使用 Monk https://github.com/LearnBoost/monk如何更新 photo2?我现在可以在遍历字段时使用索引。
我在下面的当前尝试给了我一个错误,我不能使用 JSON 选择器的变量(如索引中的)。
collection.update({_id: data._id}, {photos[i].data: filename}, function(err, updatedata) {
});