2016-06-25 3 views
0

이 Meteor 클라이언트 코드는 발견 된 문서를 갱신하지 않습니다. console.log(res)은 업데이트 할 문서가있을 때 '0'을 인쇄합니다.
왜, 어떻게 고쳐야합니까? 감사합니다cursor.forEach로 문서를 갱신하지 못합니다.

MyCollection.find({ 
    class: 'check-filter' 
}).forEach((obj) => { 
    MyCollecction.update({ 
    obj 
    }, { 
    $set: { 
     class: '' 
    } 
    }, (err, res) => { 
    if (!err) { 
     console.log(res); 
    } 
    }); 
}); 

답변

0
을 사용하도록 선택을 변경

객체의 _id : 또한

MyCollection.find({ class: 'check-filter' }).forEach(obj => { 
    MyCollection.update(obj._id, { $set: { class: '' }}, (err, res) => { 
    if (!err) { 
     console.log(res); 
    } 
    }); 
}); 

당신은 당신이 MyCollection.update

대신 MyCollecction.update을 위해 노력하고 오타가
관련 문제