Search.../

skipTo( )

Developer Preview

Refines a query that skips to a specific record.

Description

The skipTo() function refines a PoliciesQueryBuilder to return items that appear before or after the item pointed to by the provided cursor. Get the relevant cursor for a specific item from the cursors object in previous call's response. Then you can skip to cursors.prev to return items before the cursor, or cursors.next to return items after the cursor.

When using skipTo(), the filters and the sorting order of the original query can't be changed. Only the limit() property of the query can be changed.

Syntax

function skipTo(cursor: string): PoliciesQueryBuilder

skipTo Parameters

NAME
TYPE
DESCRIPTION
cursor
Optional
string

A pointer to specific record

Returns

Was this helpful?

Perform a query and skip to the next cursor

Copy Code
1import { policies } from 'wix-events.v2';
2
3export async function myQueryFunction() {
4 const results = await policies.queryPolicies().find();
5
6 const nextCursor = results.cursors.next;
7 return policies.queryPolicies().skipTo(nextCursor).find();
8}
9
Perform a query and skip to the previous cursor

Copy Code
1import { policies } from 'wix-events.v2';
2
3export async function myQueryFunction() {
4 const results = await policies.queryPolicies().find();
5
6 const prevCursor = results.cursors.prev;
7 return policies.queryPolicies().skipTo(prevCursor).find();
8}
9