Search.../

prev( )

Retrieves the previous page of query results.

Description

The prev() function retrieves the previous page of query results. 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 posts to navigate the pages of a query result. If items are added or removed between calls to prev(), the values returned may change.

Syntax

function prev(): Promise<PostsQueryResult>

prev Parameters

This function does not take any parameters.

Returns

Return Type:

Was this helpful?

Get prev from a query result

Copy Code
1const previousPage = results.prev();
2
Perform a query and get prev from the result

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