2016-01-22 75 views
1

我试图连接表ABCXYZ过滤数据,并过滤使用Strongloop列入表“XYZ”的数据。如何在包含“模式”使用strongloop

我的代码是:

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" 
    } 

Issue:'xyz'中的过滤器不起作用。请帮忙。在此先感谢

回答

0

尝试使用下面的包含过滤器:

include: { 
    relation: **XYZ**, 
    scope: { 
     where: {xyzPropertyName: 'somevalue'} 
    } 
} 

Reference

+0

由于其工作。 – NG51214