strapi icon indicating copy to clipboard operation
strapi copied to clipboard

Populate with Array doesn't work anymore

Open l0ggik opened this issue 3 years ago • 1 comments

I don't know if its me and i just do it the wrong way or if this is a bug but populate with an array of fields to populate doesn't work.

The params i try to use look like this:

const params = { populate: { contentSections: { populate: ['firstSection', 'secondSection', 'anotherSection'] }, }

If i try to fetch Data from the Backend i get the following error: "Invalid populate field. Expected a relation, got string" I also tried it with "contentSections" with the same error.

I used the same syntax with an earlier version of strapi so i know this worked before.

Would be nice to know if i do something wrong or if this is a bug either in strapi or in strapi-module.

l0ggik avatar Jul 13 '22 12:07 l0ggik

@l0ggik try

const params  =  {
  populate: [
     'contentSections.firstSection', 
     'contentSections.secondSection', 
     'contentSections.anotherSection'
  ]
}

for me this way works as expected.

paulvonber avatar Jul 15 '22 16:07 paulvonber