-
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
hasAndBelongsToMany related array has only "null" entry when limiting fields #1076
Comments
Please create a test project on github to reproduce the issue per https://github.com/strongloop/loopback/wiki/Issues. |
I created a test repository as described in the link: Just start it and use the explorer __get__Companies with the following filter: I expect the list of companies with the linked countries for each one but only the "name" property. Instead for each linked Country there is only "null" in the countries array. |
The inclusion filter is erroneous applied to the association table. As a result, the queries on related tables all become null. @raymondfeng has a fix in the works at loopbackio/loopback-datasource-juggler#476. Track progress on that issue instead, closing this one. |
I have a model which is related to another model (countries) through hasAndBelongsToMany. When I do a filter with include like this
{
"include": [{
"relation": "countries",
"scope": {
"fields": ["name"]
}
}]
}
then in my response I get something like this
"countries": [
null
]
and without the scope
"countries": [
{
"name": "Argentina",
"id": "54d11335123c16580c55e0c8",
"continentId": "54d11333123c16580c55e0c7"
}
]
The text was updated successfully, but these errors were encountered: