loopbackjs: 如何获取细节 parents 过滤相关模型

loopbackjs: how to get specifics parents filtering related model

就像一个常见的连接关系一样,我想根据 parent-child 关系中过滤后的 children 来过滤我的结果。 我做了这个

{"include":{"relation":"children","scope":{"where":{"and":[{"name":"xxx"}]}}}} 

这给了我所有 parents 并且在其中 children 按该名称过滤。

有什么线索吗?谢谢

参考: https://docs.strongloop.com/display/public/LB/Querying+related+models#Queryingrelatedmodels-Usingfiltersparameterswithincludedrelations

根据@DiogoDoreto 的 there's nothing officially available yet. There is a fork of the loopback-connector 确实尝试提供它。我没试过,但如果你要使用它,你会在过滤器中执行以下操作:

  "where": {
    "children": {
      "where": {
        "name": "xxx"
      }
    }
  }