我正在尝试将表ABC
与XYZ
连接起来,并使用Strongloop过滤包含的表'xyz'的数据。
我的代码是:
return ABC.find({filter:{
where: {abcPropertyName: {neq: '1234'}},
include: {**XYZ**: *[{xyzPropertyName: 'somevalue'}]*}}}).$promise
我的数据源是:
____ abc.json ____
"relations": {
"xyz": {
"type": "hasOne",
"model": "xyz",
"foreignKey": "abcId"
}
____ xyz.json ____
"relations": {
"abc": {
"type": "blongsTo",
"model": "abc",
"foreignKey": "abcId"
}
问题:“ xyz”中的过滤器不起作用。请帮忙。提前致谢
最佳答案
尝试使用以下包含过滤器:
include: {
relation: **XYZ**,
scope: {
where: {xyzPropertyName: 'somevalue'}
}
}
Reference