Collection fields

Collections of entries and assets are exposed through collection fields in the root query object and in one-to-many relationship fields. For example:

1type FriendlyUserCollection {
2 skip: Int!
3 limit: Int!
4 total: Int!
5 items: [FriendlyUser]!
6}
7
8input FriendlyUserFilter {
9 # ... field based filters
10}
11
12type Query {
13 # ...
14 friendlyUserCollection(
15 skip: Int
16 limit: Int
17 where: FriendlyUserFilter
18 ): FriendlyUserCollection
19}

Arguments

The following optional arguments are available when querying a collection:

ArgumentTypeDescription
skipNumberZero-indexed offset in the collection from which items are fetched. Defaults to 0.
limitNumberMaximum number of items to fetch. Defaults to 100; maximum is 1000.
whereInputTypeFilter specifications to apply on the collection query. See Collection Filters.
orderInputTypeOrder specifications to apply on the collection query. See Collection Order.
previewBooleanWhen set to true the field will be resolved with non-published content. Defaults to false.
localeStringLocale for the collection items. If not set, the default locale is used.
useFallbackLocaleBooleanWhen set to false, fields without a value in the requested locale return null instead of the fallback locale. Defaults to true. See Disabling locale fallback.

Return value

The value returned from a collection field contains the meta fields skip, limit, total, and the requested items in the items field. The skip and limit fields correspond to their respective input arguments. The total field contains the total number of items in that collection.