Practical guide

Read a bounded query across pages

Traverse a detached owner snapshot without unbounded work or assumptions about container order.

Procedure

  1. Choose a page size no larger than the data needed for one callback.
  2. Call world.query with the registered query ID and explicit filters.
  3. Consume records in returned stable order.
  4. If a next cursor is present, retain that opaque cursor and continue in a later bounded callback.
  5. Stop or degrade presentation when the query budget is exhausted or the capability is unavailable.

Example

local cursor = nil
repeat
    local result = world.query(
        "world.job.info",
        {page_size = 16, cursor = cursor}
    )
    assert(result.status == "completed", result.detail)
    for _, record in ipairs(result.records) do
        -- Consume detached records.
    end
    cursor = result.next_cursor
until cursor == nil

Constraints and recovery

Related symbols

Project references