1
sails.js에서 waterline을 사용하고 관련 "Car"모델의 ID가 지정된 목록에있는 "User"모델의 모든 레코드를 찾으려고합니다.채워진 모델의 조건이 흘수선에서 작동하지 않는 경우
var list = [3, 4, 5];
User.find().populate('car', {
where: {
id: list
}
}).exec(function(err, foundUsers){
console.log(foundUsers);
});
문제는 목록 값에 관계없이 쿼리가 실행되고 모든 레코드가 반환된다는 것입니다. 이 기준은 어떻게 적용되어야합니까?
//User:
module.exports = {
connection: 'mysqlConnection',
attributes: {
id: {
type: 'integer',
primaryKey: true,
autoIncrement: true
},
car: {
model: 'Car'
}
}
}
//Car:
module.exports = {
connection: 'mysqlConnection',
attributes: {
id: {
type: 'integer',
primaryKey: true,
autoIncrement: true
},
title: {
type: 'string'
}
}
}
문서에서 설명하는 것만 큼 이상하지 않습니다. 하지만 효과가 있습니다. 고마워요. – Behnam