Filter by properties of related models (use SQL JOIN in queries)
Ex: I have models Book and Category and i want to query Book with condition like below: Books with title contain "Art" and belongs to Category "Programming", please tell me how to do it ? I run this filter in Books model. GET /Books
{"include":{"categories"}, "where": {"title":{"like":"^Art"}, "categories.name":"Programming"}}
See https://github.com/strongloop/loopback-datasource-juggler/issues/730 for a more detailed description of the requested feature.
+1
+1
+1 please! \0/
+1 please!
This is definitely a "must have"!
+1
+1
+1
+1
+1
Please, don't spam everybody on this thread by posting +1 comments. Click on the "thumb up" icon at the top. It will also allow us to sort issues based on the number of upvotes.
For those of us arriving to this issue late, where is the appropriate place to follow progress on this feature? It looks to me like it is indeed planned.
+1 Can't believe this isn't included in the framework!
Hi, I was just wondering if there is an ETA on this issue and if there is any suggested workaround other than using bidirectional relationships?
I heard from @kjdelisle this feature is not possible unfortunately based on the currect architecture. @kjdelisle or @strongloop/sq-lb-apex could you please mention a brief note of the reasons why this feature is not possible and whether this will be available for LoopBack.Next for the people who are giving thumps up and waiting for this feature and then close it? Thanks!
CC: @bajtos
The problem is that this would require us to create a complete SQL ORM that handles multiple different SQL databases and their nuances, which has already been done in the form of things like Sequelize. Re-inventing this for our own DSL would be prohibitively complex given our current resources.
[email protected] will be easier to integrate into ORMs, frameworks, or libraries of all kinds.
Unfortunately, as a workaround for now, you'll have to build the queries yourself using the existing ParameterizedSQL functionality (to prevent SQL injection): https://apidocs.strongloop.com/loopback-connector/v/2.0.1/#using-loopback-connector
I am starting a project in loopback .. this is major drawback if we can not make where conditions for related models . This is not a feature missing .. this is issue
indeed, it`s very hard to write a non trivial application with good perfomance and clear code without this functionality. I think this should be seriously reconsidered if you plan to turn loopback in a robust framework for big applications.