-1
두 개의 스키마 Organization
과 Location
이 있습니다. Organization
스키마에 나는 위치 스키마를 참조한 :mongoosejs에서 참조 된 문서를 검색하는 방법
Organization = new Schema({
location: {
type: Schema.ObjectId,
ref: 'Location'
}
});
Location
스키마 나 특정 국가 또는 주 또는 도시로 Organization
을 어떻게 찾을 지 등 국가, 주, 도시, 지역 이제
같은 필드가 있습니다. 나는이 형태의 검색을 달성하려면 어떻게
Organization
.find()
.populate([{path:'location',select:'country state city district' },
{/*other population paths*/}] /*Some constriants here*/).exec(function(err, orgs){
console.log(orgs);
});
: 나는 몽구스 문서에서 발견 한 어떤
이 방법입니다. 이 유형의 참조 문서 검색에 사용할 수있는 플러그인이 있습니까?