Javascript 包含where inside include的环回查询

Javascript 包含where inside include的环回查询,javascript,loopbackjs,Javascript,Loopbackjs,因此,我尝试以下列方式查询我的数据: const filter = {where: {activity_id: activity_id, include: {relation: 'planGoal', scope: {where: {activity_goal_id: goal_id}}}}}; 但是,这似乎不起作用,只应用了活动id过滤器并返回了错误的数据 所以我的问题是如何在include中查询数据?甚至有可能吗 以下是相关模型供参考: { "name": "plan_goal

因此,我尝试以下列方式查询我的数据:

const filter = {where: {activity_id: activity_id, include: {relation: 'planGoal', scope: {where: {activity_goal_id: goal_id}}}}};
但是,这似乎不起作用,只应用了
活动id
过滤器并返回了错误的数据

所以我的问题是如何在include中查询数据?甚至有可能吗

以下是相关模型供参考:

    {
  "name": "plan_goal_has_action_option",
  "base": "PersistedModel",
  "idInjection": true,
  "options": {
    "validateUpsert": true
  },
  "properties": {
    "id": {
      "type": "number"
    },
    "activity_id": {
      "type": "number"
    },
    "plan_has_goal_id": {
      "type": "number"
    },
    "action_option": {
      "type": "string"
    }
  },
  "validations": [],
  "relations": {
    "planGoal": {
      "type": "belongsTo",
      "model": "plan_has_goal",
      "foreignKey": "plan_has_goal_id"
    }
  },
  "acls": [],
  "methods": {}
}


    {
  "name": "plan_has_goal",
  "base": "PersistedModel",
  "idInjection": true,
  "options": {
    "validateUpsert": true
  },
  "properties": {
    "id": {
      "type": "number"
    },
    "activity_id": {
      "type": "number"
    },
    "activity_goal_id": {
      "type": "number"
    }
  },
  "validations": [],
  "relations": {
    "goal": {
      "type": "belongsTo",
      "model": "activity_goal",
      "foreignKey": "activity_goal_id"
    },
    "actions": {
      "type": "hasMany",
      "model": "plan_goal_has_action_option",
      "foreignKey": "plan_has_goal_id"
    }
  },
  "acls": [],
  "methods": {}
}

包括
,其中
是两个不同的过滤器:

{
其中:{
活动标识:活动标识
},
包括:{
关系:“计划目标”,
范围:{
其中:{
活动\目标\标识:目标\标识
}
}
}
}