SQL native query or Loopback functions

25 views
Skip to first unread message

Irnel Victoria

unread,
Jan 19, 2018, 10:38:24 AM1/19/18
to LoopbackJS
Hello everyone

how can I do complex queries in loopback, and as it would be easier, I want to say with joins, several results, among other complex things.
I would like you to give me some examples.
Thanks in advance.

Mark Johnson

unread,
Jan 19, 2018, 7:45:54 PM1/19/18
to LoopbackJS
Have you tried doing something along the lines of this to get your raw connection for a specific model, which you can then use with your raw MySQL/PostgreSQL/MongoDB/whatever API?

const db = MyModel.dataSource.connector.db;

Message has been deleted

Irnel Victoria

unread,
Jan 20, 2018, 8:45:08 PM1/20/18
to loopb...@googlegroups.com
Hello Mark
If it is to make a restful API, for example I need to use for example with promise or functions callback or native sql (raw querie) to make a complex query with 2,3 or N models with some filters, I can use any example, which is not yet I decide which of the ways is better when the models to consult are complicated.

I can use any datasource, could be Postgres.
Reply all
Reply to author
Forward
0 new messages