Search.../

length

Returns the number of items in the current page of results.

Description

length returns just the number of items in the current page, not the total number of items that match the query. For the total number of items that match the query, see totalCount. The page size is defined by the limit() function and can be retrieved using the pageSize property. You can use the next() and prev() functions returned by backInStockNotifications to navigate the pages of a query result.

Type:

number

Was this helpful?

Get length from a query result

Copy Code
1const resultLength = results.length;
2
Perform a query and get length from the result

Copy Code
1import { backInStockNotifications } from 'wix-ecom-backend';
2
3export async function myQueryFunction() {
4 const results = await backInStockNotifications
5 .queryBackInStockNotificationRequests()
6 .find();
7
8 return results.length;
9}
10