을 채울 모든 자동차의 중첩 된 부품 객체.몽구스 다음의 3 개 모델을 가정하면 중첩 된 배열
Car.find().populate('partIds').exec(function(err, cars) {
// list of cars with partIds populated
// Try an populate nested
Part.populate(cars, {path: 'partIds.otherIds'}, function(err, cars) {
// This does not populate all the otherIds within each part for each car
});
});
아마 각 차량을 반복하고 채울 시도 할 수 있습니다
:
나는 각각 채우기 통화를하고 모두가 때까지 기다리는 비동기 같은 lib 디렉토리를 사용한다는 것을이Car.find().populate('partIds').exec(function(err, cars) {
// list of cars with partIds populated
// Iterate all cars
cars.forEach(function(car) {
Part.populate(car, {path: 'partIds.otherIds'}, function(err, cars) {
// This does not populate all the otherIds within each part for each car
});
});
});
문제 완료하고 돌아 오십시오.
모든 차량을 루핑하지 않고도 할 수 있습니까?
이 채우기 방법은 정확한 당신의 GET/포스트 노선의 내부에 발생? – Winnemucca