1
하위 문서 안에 population에 대한 참조가있는 스키마가 있습니다.배열 몽구스 배치 배열
var schema = new mongoose.Schema({
references: {
images: [{ref: 'Page', type: mongoose.Schema.Types.ObjectId}],
files: [{ref: 'Page', type: mongoose.Schema.Types.ObjectId}]
}
});
그런 다음 참조 이름 (페이지 => 페이지)과 일치하는 모델을 만듭니다.
var Page = mongoose.model('Page', schema);
해당 식별자로 페이지를 검색하고 모든 참조를 검색하려고합니다.
Page.findById(id)
.populate('references.images') // Err.. two populations..
.populate('references.files') // Err.. two populations..
.exec(function(err, page) {
// ... snip ...
});
이제 여러 모집단을 만들고 있습니다. 단일 모집단이 배열 일괄 처리를로드하도록하려면 어떻게해야합니까? 그것이 가능 3.6 시험판 때문에