Reproduction Steps
Currently, if you call GlobalDataStore:ListKeysAsync()
from the new datastore features on a datastore that was fetched with a scope, the API does not function as expected, it fails to return keys that exist.
Reproduction steps:
- Have a datastore with the following structure:
Key Name | Key Value |
---|---|
etc | etc |
4 | {Data} |
3 | {Data} |
2 | {Data} |
1 | {Data} |
- List the keys in the datastore with a scope, e.g. the player’s user ID as the scope:
local DatastoreService = game:GetService("DataStoreService")
local DatastoreOptions = Instance.new('DataStoreOptions')
DatastoreOptions:SetExperimentalFeatures({
v2 = true
})
local Datastore = DatastoreService:GetDataStore("PreAlpha_PlayerData1_Data","73223877",DatastoreOptions)
local KeyPages = Datastore:ListKeysAsync("",10)
local CurrentKeyPage = KeyPages:GetCurrentPage()
for Index,DatastoreKey in pairs(CurrentKeyPage) do
print(Index,DatastoreKey.KeyName)
end
Notice that only certain keys are displayed, and the rest are not:
- Try displaying a specific key with
ListKeysAsync
:
local DatastoreService = game:GetService("DataStoreService")
local DatastoreOptions = Instance.new('DataStoreOptions')
DatastoreOptions:SetExperimentalFeatures({
v2 = true
})
local Datastore = DatastoreService:GetDataStore("PreAlpha_PlayerData1_Data","73223877",DatastoreOptions)
local KeyPages = Datastore:ListKeysAsync("36",10)
local CurrentKeyPage = KeyPages:GetCurrentPage()
for Index,DatastoreKey in pairs(CurrentKeyPage) do
print(Index,DatastoreKey.KeyName)
end
Notice that some keys which were not displaying properly before are now being displayed:
- Enable
AllScopes
. Notice that all keys properly display.
local DatastoreService = game:GetService("DataStoreService")
local DatastoreOptions = Instance.new('DataStoreOptions')
DatastoreOptions:SetExperimentalFeatures({
v2 = true
})
DatastoreOptions.AllScopes = true
local Datastore = DatastoreService:GetDataStore("PreAlpha_PlayerData1_Data","",DatastoreOptions)
local KeyPages = Datastore:ListKeysAsync("",10)
local CurrentKeyPage = KeyPages:GetCurrentPage()
for Index,DatastoreKey in pairs(CurrentKeyPage) do
print(Index,DatastoreKey.KeyName)
end
Expected Behavior
It is expected that calling ListKeysAsync()
would list all available keys in a datastore, regardless of whether or not a datastore was fetched using a scope. If a scope was used, expected behavior is that only keys under that scope are included.
Actual Behavior
Only certain keys from a scope’d datastore are displayed. Specifically searching for keys that were omitted with the prefix filter makes the keys get displayed, otherwise they are not displayed from ListKeysAsync()
.
Workaround
None
Issue Area: Engine
Issue Type: Other
Impact: High
Frequency: Constantly
Date First Experienced: 2021-08-12 07:08:00 (-04:00)