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
Setting autoPopulate to false on relations does not return ids. #4630
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Any update or workaround on this? I'm having the same issue. |
I'm not familiar with the Strapi code base, but I would be more than happy to try to fix this myself if you could point me in the right direction! @derrickmehaffy |
Any progress on this? Does anybody have a workaround? |
@balmacefa this is something we are planning to look at in the Strapi v4 version along with the major database changes coming in Q3 |
My workaround was to let |
This issue has been mentioned on Strapi Community Forum. There might be relevant details there: https://forum.strapi.io/t/rest-api-retrieve-id-only-ids-of-relations/3399/5 |
Derrick, I linked the Strapi community to this issue, there is no solution there. Now it is just circular references to the same issue in multiple areas. |
This is an automated reply when an issue is mentioned on the forum 😉 |
I'll also link Alex's answer posted in a duplicate of this issue: |
autopopulate doesn't exist anymore, closing |
Describe the bug
I need to add
autoPopulate: false
to relational fields (one-to-many), and later get the data.E.g. Project has many Reports, when I add
"autoPopulate": false
toreports
, then the whole reports field won't return. I hope to know the ids for further use.In N-1 relation, if set
autoPopulate: false
, it will return the id, e.g.project: 1
.This problem occurs when the field is 1-N and N-N relations. The field won't return.
Steps to reproduce the behavior
autoPopulation: false
to reports fieldExpected behavior
I think it should behave the same, return
reports: [1, 2, 3]
orreports: [{id: 1}, {id: 2}, {id: 3}]
Screenshots
If applicable, add screenshots to help explain your problem.
Code snippets
System
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: