Skip to main content

count

The count method is used to get the total number of data in the corresponding Database Element.

async function count(): Promise<number>;

Reference​

Overview​

You can use the count method to get the total number of data stored in the Database Element.

import { User } from "#elements";

...

await User.count();
...

Returns​

The return value is the total number of data in the Database Element.

Examples​

count data from Database Element​

The User Database Element defines two fields, name and actived. Here's an example of getting the total number of data in the Database Element in a Function Element.

import { User } from "#elements";

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

return value:

2