【问题标题】:How to get postgres query created by Loopback 4 before it hits database?如何在 Loopback 4 访问数据库之前获取它创建的 postgres 查询?
【发布时间】:2022-12-10 13:03:00
【问题描述】:

我想根据 Loopback 4 的嵌套属性进行排序。为此,我在 Loopback 4 中找不到任何直接的方法。

http://localhost:3000/pictures?filter={"where":{"and":[{"isParent":1}]},"include":[{"relation":"comment"},{"relation":"profile"}],"offset":0,"order":["profile.fullName ASC"],"limit":5}

这给出了一个错误,因为 profile.fullName 是来自关系的嵌套属性。

所以为了找到一个解决方案,我在想如果我能得到由 Loopback 4 创建的 Postgres 查询并操作查询,然后访问数据库会怎么样。这可以做到吗?

任何帮助,非常感谢!

【问题讨论】:

    标签: loopbackjs loopback4


    【解决方案1】:

    您可以打开数据库连接的调试标志

    DEBUG=loopback:connector:* npm run start
    

    【讨论】:

      猜你喜欢
      • 2017-07-18
      • 2015-11-16
      • 2015-05-23
      • 2023-03-04
      • 2015-04-03
      • 1970-01-01
      • 2017-01-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多