# DataStoreKeyInfo

DataStoreKeyInfo : `Instance`

## Overview

An object that contains version information of a specific key in data storage.

When GetAsync or UpdateAsync method of GlobalDataStore is called, this object is returned to for user to check what version a specific key was.

## Properties

### CreatedTime

`number`

A property representing the time and date when a specific object was created.

It represents time elapsed since Unix Epoch (1970-01-01 00:00:00 UTC) in milli second.

#### Code Samples

```lua
local DataStoreService = game:GetService("DataStoreService")
local GoldStore = DataStoreService:GetDataStore("PlayerGold")

local success, errorMessageOrLoadValue, keyInfo = pcall(function()
    return GoldStore:GetAsync(player.UserId)
end)

if not success then
    print("errorMessage : ", errorMessageOrLoadValue)
else
    local loadValue = errorMessageOrLoadValue
    local createdTime = keyInfo.CreatedTime
    local version = keyInfo.Version
    local updatedTime = keyInfo.UpdatedTime
end
```

### UpdatedTime

`number`

A property representing the time and date when a specific object was edited.

It represents time elapsed since Unix Epoch (1970-01-01 00:00:00 UTC) in milli second.

#### Code Samples

```lua
local DataStoreService = game:GetService("DataStoreService")
local GoldStore = DataStoreService:GetDataStore("PlayerGold")

local success, errorMessageOrLoadValue, keyInfo = pcall(function()
    return GoldStore:GetAsync(player.UserId)
end)

if not success then
    print("errorMessage : ", errorMessageOrLoadValue)
else
    local loadValue = errorMessageOrLoadValue
    local createdTime = keyInfo.CreatedTime
    local version = keyInfo.Version
    local updatedTime = keyInfo.UpdatedTime
end
```

### Version

`string`

A unique identifier designed to tell apart individual versions of a specific object.

#### Code Samples

```lua
local DataStoreService = game:GetService("DataStoreService")
local GoldStore = DataStoreService:GetDataStore("PlayerGold")

local success, errorMessageOrLoadValue, keyInfo = pcall(function()
    return GoldStore:GetAsync(player.UserId)
end)

if not success then
    print("errorMessage : ", errorMessageOrLoadValue)
else
    local loadValue = errorMessageOrLoadValue
    local createdTime = keyInfo.CreatedTime
    local version = keyInfo.Version
    local updatedTime = keyInfo.UpdatedTime
end
```

## Methods

### GetMetadata

Returns additional information (metadata) of a specific object.

#### Parameters

#### Return

| `Dictionary` | Additional information (metadata) in key-value form. |
| ------------ | ---------------------------------------------------- |

#### Code Samples

```lua
local DataStoreService = game:GetService("DataStoreService")
local GoldStore = DataStoreService:GetDataStore("PlayerGold")

local success, errorMessageOrLoadValue, keyInfo = pcall(function()
    return GoldStore:GetAsync(player.UserId)
end)

if not success then
    print("errorMessage : ", errorMessageOrLoadValue)
else
    local loadValue = errorMessageOrLoadValue
    local metadata = keyInfo:GetMetadata()

    print(metadata)
end
```

### GetUserIds

Returns the user ID array of a specific object.

#### Parameters

#### Return

| `Array` | An array of user IDs. |
| ------- | --------------------- |

#### Code Samples

```lua
local DataStoreService = game:GetService("DataStoreService")
local GoldStore = DataStoreService:GetDataStore("PlayerGold")

local success, errorMessageOrLoadValue, keyInfo = pcall(function()
    return GoldStore:GetAsync(player.UserId)
end)

if not success then
    print("errorMessage : ", errorMessageOrLoadValue)
else
    local loadValue = errorMessageOrLoadValue
    local userIds = keyInfo:GetUserIds()

    print(userIds)
end
```

## Events


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.overdare.com/development/api-reference/classes/datastorekeyinfo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
