简体   繁体   中英

How to get postgres query created by Loopback 4 before it hits database?

I want to sort based on the nested property of Loopback 4. I can't find any direct way in Loopback 4 for this.

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

This gives an error coz profile.fullName is a nested property from relation.

So to find a solution for this, I was thinking what if I can get the Postgres query created by Loopback 4 and manipulate the query, and then hit the database. Can this be done?

Any help, highly appreciated!

You can turn on the debugging flag for database connection

DEBUG=loopback:connector:* npm run start

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM