Introduction

When you execute a query with the find() function, it returns a Promise that resolves to an EventsQueryResult object. This object contains the items that match the query, information about the query itself, and functions for paging through the query results.

Did this help?

currentPage


currentPagenumberRead-only

Returns the index of the current results page number.

The currentPage is a zero-based index of the current page of results.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

The currentPage property returns undefined if the query returned no results.

JavaScript
const resultPage = results.currentPage; // 0
Did this help?

items


itemsArray<WixEvent>Read-only

Returns the items that match the query.

The current page of Wix events retrieved by the query.

Note: When no items match the query, the items array is empty.

To paginate your query results, use the EventsQueryResult pagination properties and functions.

Perform a find on a query
JavaScript
import { wixEvents } from "wix-events-backend"; // ... wixEvents .queryEvents() .find() .then((results) => { if (results.items.length > 0) { const items = results.items; const firstItem = items[0]; const totalCount = results.totalCount; const pageSize = results.pageSize; const currentPage = results.currentPage; const totalPages = results.totalPages; const hasNext = results.hasNext(); const hasPrev = results.hasPrev(); const length = results.length; const query = results.query; } else { // handle case where no matching items found } }) .catch((error) => { const queryError = error; });
Did this help?

length


lengthnumberRead-only

Returns the number of items in the current results page.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

JavaScript
const resultLength = results.length; // 20
Did this help?