local memoryStoreService = game:GetService("MemoryStoreService")
local SortedMap = memoryStoreService:GetSortedMap("test2")
local data = SortedMap:GetRangeAsync(Enum.SortDirection.Descending)
Expected Behavior
According to the Memory Store page (Memory Store) this should return ALL key values in the sorted map if no range is given.
BUT it says the highest value you can give is 200 in the API page though (GetRangeAsync).
I expect if i leave the second parameter blank, it should return ALL key values in the entire sorted map.
Actual Behavior
However in studio when I try to input a range higher than 100 it says this.
Issue Area: Engine Issue Type: Other Impact: High Frequency: Constantly Date First Experienced: 2021-09-23 00:09:00 (-04:00) Date Last Experienced: 2021-09-26 00:09:00 (-04:00)
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