Search.../

totalPages

Returns the total number of pages the query produced.

Description

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 categories to navigate the pages of a query result.

Type:

undefined

 | 

number

Was this helpful?

Get totalPages from a query result

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

Copy Code
1import { categories } from 'wix-blog-backend';
2
3export async function myQueryFunction() {
4 const results = await categories.queryCategories().find();
5
6 return results.totalPages;
7}
8