-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundIf it breaks the basic use of the product but can be worked aroundsource: core:strapiSource is core/strapi packageSource is core/strapi packagestatus: confirmedConfirmed by a Strapi Team member or multiple community membersConfirmed by a Strapi Team member or multiple community members
Description
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 to reports, then the whole reports field won't return. I hope to know the ids for further use.
"reports": {
"collection": "report",
"via": "project",
"autoPopulate": false
},
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
- Go to a one-to-many relational fields, e.g. Project has many reports
- Add
autoPopulation: falseto reports field - GET /projects/1
- The report field doesn't return.
Expected behavior
I think it should behave the same, return reports: [1, 2, 3] or reports: [{id: 1}, {id: 2}, {id: 3}]
Screenshots
If applicable, add screenshots to help explain your problem.
Code snippets
{
"connection": "default",
"collectionName": "projects",
"info": {
"name": "project",
"description": ""
},
"options": {
"increments": true,
"timestamps": [
"created_at",
"updated_at"
],
"comment": ""
},
"attributes": {
"name": {
"unique": true,
"required": true,
"type": "string"
},
"reports": {
"collection": "report",
"via": "project"
},
"comments": {
"collection": "comment",
"via": "project"
}
}
}
System
- Node.js version: 10.16.1
- NPM version: 6.9.0
- Strapi version: 3.0.0-beta.17.6
- Database: SQLite
- Operating system: Windows
Additional context
Add any other context about the problem here.
mizvyt, eulervoid, denforlatte, kevinh94, balmacefa and 2 more
Metadata
Metadata
Assignees
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundIf it breaks the basic use of the product but can be worked aroundsource: core:strapiSource is core/strapi packageSource is core/strapi packagestatus: confirmedConfirmed by a Strapi Team member or multiple community membersConfirmed by a Strapi Team member or multiple community members