如果可能,我想使用查询参数查询相关模型,而不是覆盖蓝图操作 . 我不确定是否需要手动填充关联才能使其正常工作 .

我有两个相关的模型:Idea和Tag . 一个Idea可以有很多标签,一个标签可以与许多想法(M-M关联)相关联 . 我想查询与给定标签名称相关联的所有创意 .

我过去有这个工作,但现在结果总是一个空数组 . 我查看了我的git历史,我有两种不同的可能的解决方案,我过去使用过

Blueprint Endpoint(过去的工作?):

示例Idea实例(为简洁起见,删除了其他关联):

{
  "tags": [
    {
      "text": "GIS",
      "description": "Geographic Information Systems involves the association of location and attribute data, data collection, and analysis.",
      "approved": true,
      "createdAt": "2015-08-26T13:27:19.593Z",
      "updatedAt": "2015-08-26T13:29:44.209Z",
      "id": "55ddbeb71670cf062be4e5c0"
    }
  ],
  "title": "First Idea",
  "description": "Let's all do some more GIS!",
  "status": "Proposed",
  "createdAt": "2015-08-26T13:30:03.238Z",
  "updatedAt": "2015-08-26T13:30:03.240Z",
  "id": "55ddbf5b1670cf062be4e5c1"
}