0
두 번째 쿼리에서이 필드가 정의되지 않은 이유는 무엇입니까? 코드는 다음과 같습니다.쿼리 내의 쿼리에서 MongoDB 값에 액세스
Survey.findById(req.params.id, function(err, survey) {
for (var i=0; i<=survey.businesses.length-1; i++) {
console.log(survey.businesses[i].votes); // This returns the expected value
UserSurvey.find({ surveyId: req.params.id, selections: survey.businesses[i].id }, function(err, usurvey) {
console.log(survey.businesses[i].votes); // businesses[i] is undefined
});
}
});
훌륭함 - 완벽하고 완벽하게 작동합니다. 이것에 대해 고마워. 많이 배우기! –