-
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 relation filter crashes loopback #3233
Comments
@KevinMongiello nice job with the sample repository! I am able to see the error. let me take a look at what is failing. |
@KevinMongiello This would need a fix, I have temporary solution for the issue, if you query with |
@bajtos @superkhau the following line creates a filter with only the query fields {'post': {fields: 'id'}}, but does not add relation.keyFrom : so , the data retrieved does not have the authorId and later at line https://github.com/strongloop/loopback-datasource-juggler/blob/76c73d55d28dfa150b9e004aeae12aafe0ce6475/lib/include.js#L599 , |
I'm not familiar enough with this area of code, @raymondfeng can you chime in here? |
@bajtos @superkhau @raymondfeng @jannyHou : I reported this issue a while ago in the datasource-juggler: For now you need to manually include the foreign key in the scope of the incriminated relation for it to work, otherwise it crashes the app |
I've found that |
Thank you @ebarault for chiming in. I am closing this issue as a duplicate of loopbackio/loopback-datasource-juggler#779 then. |
Description/Steps to reproduce
Minimal repo with which to reproduce bug:
https://github.com/KevinMongiello/loopback_include_bug
Steps to reproduce:
0a) Run mongodb
0b) Open up explorer
http://localhost:3333/explorer
{"include": {"relation": "post", "scope": {"fields": "id"}} }
Loopback will crash with
TypeError: Cannot read property 'toString' of undefined
Expected result
Expected result is to return all authors with a property
posts
that only includes each post's id.Actual result: Loopback crashes.
Additional information
darwin x64 6.2.0
[email protected] /Users/kmong/CaliberMind/Work/scrap/bugs/loopback_include_bug
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
The text was updated successfully, but these errors were encountered: