paginate()

Get the first page of size Set values.

Signature

paginate(): Page<A>

paginate(size: Int): Page<A>

Description

The paginate() method gets the first page of size Set values. When the Set has more than size values, a pagination cursor is included at the end of the page.

Use the static Set.paginate() method to access subsequent pages.

Parameters

Parameter Type Required Description

size

Int

Number of Set values to include in the returned page. See Limits for the minimum and maximum number of paginated values.
default = 16

Return value

Type Description

Page

Object
data is page values as an Array.
after is included when there are more pages of values.

Examples

Apply a page size of two to the Set of all Product documents:

Letter.all().paginate(2)
{
  data: [
    {
      id: "101",
      coll: Letter,
      ts: Time("2022-11-18T21:23:43.310Z"),
      letter: "A",
      extra: "First"
    },
    {
      id: "102",
      coll: Letter,
      ts: Time("2022-11-18T21:23:43.310Z"),
      letter: "B",
      extra: "second"
    }
  ],
  after: "hs6DxoJmTGV0dGVygwAAZipudWxsKoJjYWxsgwAAZipudWxsKoMAAGYqbnVsbCqAgEoAAAAAAAAAZgQA9cGCGmN3998aGBSNAA=="
}

See also

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!