MemoryStoreSortedMap:GetRangeAsync() can only get 1-100 entries

We should clarify the documentation. The function allows requesting up to 200 keys at once. If the sorted map has more keys than that, you’ll need to make multiple calls in a loop to retrieve all of them. You can use the exclusiveLowerBound parameter to avoid retrieving keys that were already retrieved in prior iterations as shown in the example below:

local mss = game:GetService("MemoryStoreService")
local map = mss:GetSortedMap("listing_test")

local startFrom = nil
local page = {}

repeat
    page = map:GetRangeAsync(Enum.SortDirection.Ascending, 200, startFrom)
    for _, pair in ipairs(page) do
        print("key = " .. pair.key .. ", value = " .. pair.value)
    end
    if #page > 0 then
        startFrom = page[#page].key
    end
until #page == 0
12 Likes