Loopback: Querying model: filter by related model properties

Created on 21 Oct 2015  路  1Comment  路  Source: strongloop/loopback

Hello. Please help me to understand loopback principles.

For example, i have a "User" model with oneToMany relation to "Photo" model with "status" property (string). My goal is to query only "User" which have "Photo"s with status == "active". As i understand from docs i can query "User" model and include "Photo"s there, specifiying "where" field for "Photo" model, but that's not my goal. Instead i want filter "User" based on their "Photo"s statuses. Is it possible with loopback?

Most helpful comment

Found an answer to my question in this issue: https://github.com/strongloop/loopback/issues/517
Its not implemented yet. However, @DiogoDoreto made a fork to loopback-mysql-adapter which might help.
https://github.com/strongloop/loopback/issues/517#issuecomment-148616091

>All comments

Found an answer to my question in this issue: https://github.com/strongloop/loopback/issues/517
Its not implemented yet. However, @DiogoDoreto made a fork to loopback-mysql-adapter which might help.
https://github.com/strongloop/loopback/issues/517#issuecomment-148616091

Was this page helpful?
0 / 5 - 0 ratings