-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include with filter does not filter out where condition #3365
Comments
Do you have a model that links those two models together? It would help if you could create a sample repo so I can reproduce the exact issue you are seeing. |
I actually think I may be in a similar boat on this one. I need to re-structure the project to provide a sample repo, but in the interim, try enterying a vald but crazy query in the loopback explorer. For instance, every one of my models will match based on the clearly nonsen {"adsfafda": "adsfklhasglhk"} Since I thought that was crazy, I can then copy and paste any of the returned propterties / values (that come back as the response to the above Loopback Explorer Query) back into the filter field (where that property / value DOES NOT match more than one instance, but does match exactly one instance) and yet again it returns all instances of the model. Might be worth trying to reproduce that behavior in your case to see if we are on the same page. I burnt myself out on this one over the past couple of hours so I am going to put it down and pick it back up tomorrow. My thinking is that it has to be something with the model names / relationships since I have been by hand editing my model.json files. I think what I will do tomorrow is attempt to re-create the models using the CLI and see if I can get around the issue / find the bug in my JSON that way. I think that it presented itself around the time I added a second belongsToOne relationship to a single model. ie. Date Belongs to One Trip, Belongs to One Deal in my case. |
My filters, both Node Syntax and Rest Syntax (through Loopback Explorer) are still failing to filter data appropriately. Updates since Yesterday:
Next steps:
Continuing to trouble shoot my issue. In reference to the OP issue, I am posting here only because my Filters are also not working. I do not use hasAndBelongsToMany. |
Update from Yesterday:
Most importantly: Result: After cloning, doing NPM install, and prior to moving ANY of my code / models over, I created a single test model and tested Filters against that model in the base loopback-sandbox repo. The bug presented it's self within my Docker Alpine Loopback Container with none of my code / models. Therefore I exited Docker and ran without Virtualization on OSX. The Bug persisted. At this point it is safe to say that either it is an issue with my OS / variables that is some how passed through from my host, or vice versa (which to my knowledge would be difficult or impossible) or that this is a bug in loopback that came about related to a breaking dependency update that happened recently. I did recently (prior to experiencing the Filters bug for the first time) add both Lodash and Async to to my project. My guess is that when I installed either the Async module, or alternately Lodash (neither of which existed in my project prior to this issue presenting itself) then one of those packages updated one of the dependencies that is shared by both Loopback AND the offending module. Since the breaking co-dependency change was the latest version of whatever that co-dependency requires, when I then cloned the loopback-sandbox and did an NPM install I believe it would also pull this latest version and therefore also does not work. Moving toward filing a full bug report / opening a new issue. |
@0candy @sneakersgames I was able to reproduce on two OSes using the sandbox repo with no-changes. |
Following the documentation as regarding scope on include filter: https://loopback.io/doc/en/lb3/Include-filter.html
Gives me an array with Spots without categoryId 45:
I would expect this object isn't returned since it doesn't have categoryId 45
spot.json
category.json
The text was updated successfully, but these errors were encountered: