> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Resource: Items

# Type: WixDataQuery

# Action: count

# Link: https://dev.wix.com/docs/sdk/data-items-sdk/data/items/wix-data-query/count.md

## Description: Returns the number of items that match the query.

The `count()` method returns a Promise that resolves to the number of
items that match the query. The Promise is rejected if `count()` is called
with incorrect permissions or if any of the methods used to refine the
query is invalid.

Calling the `count()` method triggers the [`beforeCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-count.md) and [`afterCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-count.md) hooks if they have been defined.

Use the `options` parameter to run `count()` without checking for permissions
or without its registered hooks.

Any method that does not filter query results (e.g., [`ascending()`](#ascending))
does not affect the result of `count()`.

If you build a query and don't refine it with any `WixDataQuery` methods,
`count()` returns the total number of items in the collection.

> **Note**: You can also retrieve the number of query results by calling `find()` and setting the `options.returnTotalCount` property to `true`.

## Schema:

```json
 Method: count(options)
 Description: Returns the number of items that match the query.  The `count()` method returns a Promise that resolves to the number of items that match the query. The Promise is rejected if `count()` is called with incorrect permissions or if any of the methods used to refine the query is invalid.  Calling the `count()` method triggers the [`beforeCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-count.md) and [`afterCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-count.md) hooks if they have been defined.  Use the `options` parameter to run `count()` without checking for permissions or without its registered hooks.  Any method that does not filter query results (e.g., [`ascending()`](#ascending)) does not affect the result of `count()`.  If you build a query and don't refine it with any `WixDataQuery` methods, `count()` returns the total number of items in the collection.  > **Note**: You can also retrieve the number of query results by calling `find()` and setting the `options.returnTotalCount` property to `true`.
 Method parameters:
   param name:  options | type: WixDataReadOptions | description:  Options to use when processing this operation. 
       - name: appOptions  | type: Record<string, any> | description:  Options for [querying Wix app collections](https://dev.wix.com/docs/develop-websites/articles/wix-apps/wix-app-collections/querying-wix-app-collections.md). 
       - name: consistentRead  | type: boolean | description:  When `true`, reads data from the primary database instance. This decreases performance but ensures data retrieved is up-to-date even immediately after an update. Learn more about [Wix Data and eventual consistency](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency.md). 
       - name: language  | type: string | description:  Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. If provided, the result text is returned in the specified language. If not provided, the result text is not translated.  > **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual). 
       - name: showDrafts  | type: boolean | description:  When `true`, operations include draft items. Read operations include draft items in their response, and write operations modify draft items.  Default: `false`. 
       - name: suppressHooks  | type: boolean | description:  Prevents hooks from running for the operation. Can only be used in the [backend code of a Wix site](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/backend-code/about-the-site-backend.md).  Default: `false`. 
 Return type: PROMISE<number>

```