Search.../

find( )

Returns the items that match the query.

Description

The find() function returns a Promise that resolves to the results found by the query and some information about the results. The Promise is rejected if find() is called with incorrect permissions or if any of the functions used to refine the query are invalid.

Syntax

function find(): Promise<PublicPlansQueryResult>

find Parameters

This function does not take any parameters.

Returns

Fulfilled - A Promise that resolves to the results of the query. Rejected - Error that caused the query to fail.

Return Type:

Was this helpful?

Perform a find on a query

Copy Code
1import wixPricingPlansBackend from 'wix-pricing-plans-backend';
2
3// ...
4
5wixPricingPlansBackend.queryPublicPlans()
6 .find()
7 .then((results) => {
8 if (results.items.length > 0) {
9 const items = results.items;
10 const firstItem = items[0];
11 const totalCount = results.totalCount;
12 const pageSize = results.pageSize;
13 const currentPage = results.currentPage;
14 const totalPages = results.totalPages;
15 const hasNext = results.hasNext();
16 const hasPrev = results.hasPrev();
17 const length = results.length;
18 const query = results.query;
19 } else {
20 // handle case where no matching items found
21 }
22 })
23 .catch((error) => {
24 const queryError = error;
25 });