Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ You can specify a prefix when listing all data stores or keys, and get back only
For new experiences, use [listing and prefixes](#listing-and-prefixes) to organize keys in your data store instead of the legacy scopes feature. For existing experiences that use scopes, continue using them.
</Alert>

Every key in a data store has a default global scope. You can organize keys further by setting a unique string as a scope for the second parameter of `Class.DataStoreService:GetDataStore()|GetDataStore()`. This automatically attaches the scope to the beginning of all keys in all operations done on the data store.
You can organize keys in a data store further by setting a unique string as a scope for the second parameter of `Class.DataStoreService:GetDataStore()|GetDataStore()`. The default scope (if no scope is given) is `global`. The scope is automatically prepended to the beginning of all keys in all operations done on the data store.

<table>
<thead>
Expand All @@ -148,7 +148,7 @@ Every key in a data store has a default global scope. You can organize keys furt
</tbody>
</table>

The combination of data store name, scope, and key uniquely identifies a key. All three values are required to identify a key with a scope. For example, you can read a global key named `User_1234` as:
The combination of data store name, scope, and key uniquely identifies a key. All three values are required to identify a key with a scope. For example, you can read a `global`-scoped key named `User_1234` as:

```lua
local DataStoreService = game:GetService("DataStoreService")
Expand All @@ -158,7 +158,7 @@ local success, currentGold = pcall(function()
end)
```

If the key `User_1234` has a scope of gold, though, you can only read it as:
If the key `User_1234` has a scope of `gold`, though, you can only read it as:

```lua
local DataStoreService = game:GetService("DataStoreService")
Expand All @@ -184,7 +184,7 @@ local ds = DataStoreService:GetDataStore("DS1", "", options)
```

<Alert severity="info">
When you use the `Class.DataStoreOptions.AllScopes|AllScopes` property, `Class.DataStore:ListKeysAsync()|ListKeysAsync()` returns every key with their scope as the prefix argument, such as `global/player_data_1234` or `houses/house3`. The default scope is `global`.
When you use the `Class.DataStoreOptions.AllScopes|AllScopes` property, `Class.DataStore:ListKeysAsync()|ListKeysAsync()` returns every key with their scope as the prefix argument, such as `global/player_data_1234` or `houses/house3`. Remember that the default scope is `global`.
</Alert>

If you enable the `Class.DataStoreOptions.AllScopes|AllScopes` property and create a new key in the data store, you must always specify a scope for that key in the format of scope/keyname. If you don't, the APIs throw an error. For example, `gold/player_34545` is acceptable with gold as the scope, but `player_34545` leads to an error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ methods:
`Class.DataStoreService:GetDataStore()|GetDataStore()` function.

Note that the `Class.DataStore` returned by this function always uses the
scope `u`. See [Data stores](../../../cloud-services/data-stores/index.md)
scope `u`. See
[Versioning, listing, and caching](../../../cloud-services/data-stores/versioning-listing-and-caching.md#scopes)
for details on scope.
code_samples:
- get-a-globaldatastore-instance
Expand Down
14 changes: 6 additions & 8 deletions content/en-us/reference/engine/classes/OrderedDataStore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,20 @@ memory_category: Instances
summary: |
A GlobalDataStore that also allows for ordered data store entries.
description: |
A **OrderedDataStore** is essentially a `Class.GlobalDataStore` with the
exception that stored values must be **positive integers**. It exposes a
method `Class.OrderedDataStore:GetSortedAsync()|GetSortedAsync()` which allows
inspection of the entries in sorted order using a `Class.DataStorePages`
object.
An **OrderedDataStore** is essentially a `Class.GlobalDataStore` with stored values that are **integers**.
It exposes the `Class.OrderedDataStore:GetSortedAsync()|GetSortedAsync()` method, which allows for the
inspection of entries in sorted order using a `Class.DataStorePages` object.

Ordered data stores do not support versioning and metadata, so
`Class.DataStoreKeyInfo` is always `nil` for keys in an
`Class.OrderedDataStore`. If you need versioning and metadata support, use a
`Class.DataStore`.

Ordered data stores do not support the optional `userIds` parameter for
Ordered data stores also do not support the optional `userIds` parameter for
`Class.OrderedDataStore:SetAsync()|SetAsync()` or
`Class.OrderedDataStore:IncrementAsync()|IncrementAsync()`.

See [Data Stores](../../../cloud-services/data-stores/index.md) for an
See [Data stores](../../../cloud-services/data-stores/index.md) for an
overview on using ordered data stores.
code_samples:
- OrderedDataStore-Basics
Expand All @@ -44,7 +42,7 @@ methods:
**minValue**/**maxValue** are optional parameters which filter the
results.

See [Data Stores](../../../cloud-services/data-stores/index.md) for
See [Error codes and limits](../../../cloud-services/data-stores/error-codes-and-limits.md) for
request limits and descriptions of the error codes.
code_samples: []
parameters:
Expand Down