-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: lowIf the issue only affects a very niche base of users and an easily implemented workaround can solveIf the issue only affects a very niche base of users and an easily implemented workaround can solvesource: core:databaseSource is core/database packageSource is core/database packagestatus: pending reproductionWaiting for free time to reproduce the issue, or more informationWaiting for free time to reproduce the issue, or more information
Description
Bug report
Required System information
- Node.js version: 16
- NPM version: 8.1.2
- Strapi version: 4.1.9
- Database: mysql/sqlite
- Operating system: windows
Describe the bug
Add "useJoinTable": false to manyToOne relation break population when combined with select
Steps to reproduce the behavior
- Create
audiocontent types withnameattribute - Create
playlistcontent type withname,formatattributes - Create
manyToOnerelation onaudioinversedByaudiosonplaylist, manually add"useJoinTable": false - Query make a simple query on
audio, selectnameand populateplaylist
const entries = await strapi.db.query('api::audio.audio').findMany({
limit: 10,
select: ['name'],
populate: {
playlist: {
select: ['name']
},
},
})
playlistnot populated
[
{
"name": "a1",
"id": 1,
"playlist": null
}
]
Expected behavior
playlist should be populated
[
{
"id": 1,
"name": "a1",
"playlist": {
"name": "p1",
"id": 1
}
}
]
Code snipets
audio schema:
{
"kind": "collectionType",
"collectionName": "audios",
"info": {
"singularName": "audio",
"pluralName": "audios",
"displayName": "audio",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"name": {
"type": "string"
},
"playlist": {
"type": "relation",
"relation": "manyToOne",
"target": "api::playlist.playlist",
"inversedBy": "audios",
"useJoinTable": false
}
}
}
playlist schema:
{
"kind": "collectionType",
"collectionName": "playlists",
"info": {
"singularName": "playlist",
"pluralName": "playlists",
"displayName": "playlist",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"name": {
"type": "string"
},
"audios": {
"type": "relation",
"relation": "oneToMany",
"target": "api::audio.audio",
"mappedBy": "playlist"
},
"format": {
"type": "enumeration",
"enum": [
"a",
"b",
"c"
]
}
}
}
Additional context
If select omitted, the playlist populated properly
Metadata
Metadata
Assignees
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: lowIf the issue only affects a very niche base of users and an easily implemented workaround can solveIf the issue only affects a very niche base of users and an easily implemented workaround can solvesource: core:databaseSource is core/database packageSource is core/database packagestatus: pending reproductionWaiting for free time to reproduce the issue, or more informationWaiting for free time to reproduce the issue, or more information