# Entity Service API: Populating
The Entity Service API does not populate relations, components or dynamic zones by default.
# Basic populating
To populate all the root level relations, use populate: '*'
:
const entries = await strapi.entityService.findMany('api::article.article', {
populate: '*',
});
1
2
3
2
3
Populate various component or relation fields by passing an array of attribute names:
const entries = await strapi.entityService.findMany('api::article.article', {
populate: ['componentA', 'relationA'],
});
1
2
3
2
3
# Advanced populating
An object can be passed for more advanced populating:
const entries = await strapi.entityService.findMany('api::article.article', {
populate: {
relationA: true,
repeatableComponent: {
fields: ['fieldA'],
filters: {},
sort: 'fieldA:asc',
populate: {
relationB: true,
},
},
},
});
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Complex populating can be achieved by using the filters
parameter and select or populate nested relations or components:
const entries = await strapi.entityService.findMany('api::article.article', {
populate: {
relationA: {
filters: {
name: {
$contains: 'Strapi',
},
},
},
repeatableComponent: {
fields: ['someAttributeName'],
sort: ['someAttributeName'],
populate: {
componentRelationA: true,
},
},
},
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Populate Fragments
When dealing with polymorphic data structures (dynamic zones, polymorphic relations, etc...), it is possible to use populate fragments to have a better granularity on the populate strategy.
const entries = await strapi.entityService.findMany('api::article.article', {
populate: {
dynamicZone: {
on: {
'components.foo': {
fields: ['title'],
filters: { title: { $contains: 'strapi' } },
},
'components.bar': {
fields: ['name'],
},
},
},
morphAuthor: {
on: {
'plugin::users-permissions.user': {
fields: ['username'],
},
'api::author.author': {
fields: ['name'],
},
},
},
},
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26