Manual Pagination
paginateRecords(entityKey, options?) — Async Generator
The SDK provides an async generator that handles cursor passing automatically:Options
Safety Limits
To prevent unbounded iteration on large entities, usemaxPages and/or maxRecords:
Error Handling During Pagination
paginateRecords and all read methods are allowed during maintenance mode.
Page Size Limits
A
pageSize above 100 is clamped to 100.
How cursors behave
- Keyset, not offset. A cursor records the position of the last record on the page (its sort value and id), so records inserted while you page never shift or duplicate what you see, and page 1,000 costs the same as page 1.
- Opaque and bound to the sort. A cursor is encrypted — it reveals nothing about the record it points at. Repeat the same
sortwith every cursor. A cursor sent with a differentsort, altered in any way, or issued before the sorted field changed type is rejected with422 VALIDATION_FAILED(param: "cursor") rather than silently restarting at page one. - Long sort values. A sort value too long to fit in a cursor (several kilobytes of text) is rejected up front with
422(param: "sort"); sort on a shorter field. - Null ordering. Records whose sort field is unset come last when sorting ascending and first when sorting descending.
- Index-served sorts. Sorting on a field declared
indexed: truereads in index order instead of sorting the whole entity. See Indexing fields.