[BUG] Population breaks when specify array of multiple objects (necessary for nested population)
See original GitHub issueWhen using population the module has a bug regarding array of population objects. I have four schemas: games, characters, locations and events. The schema itself does not really matter. When I specify an array of strings for fields to be populated, it works.
WORKING
axios({
method:'get',
url: config.apiUri + '/game/' + id,
params: {
populate: ['characters', 'events', 'locations'],
},
})
If you want to do a nested populate you would need to specify a path. The following example also works (also the nested events field gets populated).
WORKING
axios({
method:'get',
url: config.apiUri + '/game/' + id,
params: {
populate: [{
path: 'locations',
populate: {
path: 'events'
},
}],
},
})
However if you specify an array of objects as populate param, the population breaks and all populated fields return a null value. This happens regardless whether you do a nested population or not.
NOT WORKING
axios({
method:'get',
url: config.apiUri + '/game/' + id,
params: {
populate: [{
path: 'locations',
populate: {
path: 'events'
},
}, {
path: 'characters'
}],
},
})
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Bug - Error displaying nested arrays in the inspector
After the transition to 2020.3.6, there was a problem with displaying nested arrays if there are more than two of them in the...
Read more >python - Unable to exit nested while loops - Stack Overflow
I am writing a program that tracks populations given birth and death rates. Each cell of the population is a 'dictionary' object that...
Read more >Arrays - The Modern JavaScript Tutorial
Arrays. Objects allow you to store keyed collections of values. That's fine. But quite often we find that we need an ordered collection, ......
Read more >breaking change: Can't use nested arrays or arrays of objects ...
Reporting a bug? In vue-i18n v8.0.0, I was able use nested arrays of objects to manage translatable content for "About" or "FAQ" pages....
Read more >Flattening nested arrays - Amazon Athena
To flatten a nested array's elements into a single array of values, use the flatten function. This query returns a row for each...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Zertz Thank you, didn’t know about this not being standardized. Sorry for making a fuzz,
Passing arrays in query strings isn’t standardized and axios seems to be generating a different format.
What I usually do is build a plain old JavaScript object and then
JSON.stringify
it into the query string.