回送查询相关模型字段

时间:2019-07-16 08:12:25

标签: loopbackjs loopback

我正在尝试查询与团队ID字段相关的人员ID。找不到解决方案。

in person.json:

"relations": {
        "team": {
            "type": "hasMany",
            "model": "Team",
            "foreignKey": "teamID"
        }
    }

,其中此字段为:Team.getTeams = async function (uid) { let ids = await loopback.findModel('Team').find({ where: { or: [ { owner: new Object(uid) } ] }, include: { relation: 'people', scope: { where: { id: uid } } }, field: { id: true }, }); let ret = []; ids.forEach(i => { ret.push([i.id, i.title]); }); return ret; };

regex

这是我要执行的查询:

regex("1.*")

0 个答案:

没有答案