Skip to main content

keys

The keys method is used to retrieve all the keys of data in the corresponding Database Element.

async function keys(): Promise<Array<string>>;

Reference​

Overview​

You can use the key method to retrieve all the keys of data stored in the Database Element.

import { User } from "#elements";

...

await User.keys();
...

Returns​

The return value is an array of all keys in the Database Element.

Examples​

get keys from Database Element​

The User Database Element defines two fields, name and activedHere's an example of getting all keys from the Database Element in a Function Element.

import { User } from "#elements";

export default async function () {
return await User.keys();
}

return value:

[
"user-1",
"user-2"
]