에 정렬을 수행SailsJS 여기에 내 현재 <strong>이벤트 모델</strong>입니다 데이터 채우기
module.exports = {
attributes: {
name: {
type: 'string',
required: true,
unique: true
},
client: {
model: 'client',
required: true
},
location: {
model: 'location',
required: true
}
}
};
클라이언트 모델 : 나는 client name
에 따라 정렬이 구현 어떻게 그래서
module.exports = {
attributes: {
name: {
type: 'string',
required: true,
unique: true
},
address: {
type: 'string'
},
clientContact: {
model: 'user',
required: true
}
}
};
또한 skip
및 limit
속성 (페이지 매김의 경우)이 함께 작동합니다.
Event.find({ id: ['583eb530902db3d926345215', '583eb6dd91b972ee26dd97b1'] },
{ select: ['name', 'client'] })
.populate('client', { sort: 'name DESC' })
.exec((err, resp) => resp.map(r => console.log(r.name, r.client)));
을하지만 그것을 할 것 같지 않습니다
나는 다음과 같은 쿼리를 사용했습니다.
난 당신이 찾고있는 것을 생각 여기 : http://stackoverflow.com/questions/22996210/sort-by-the-association-with-populate –