Search.../

find( )

Developer Preview

Returns the query results.

Description

The find() function returns a Promise that resolves to the query results and metadata. The Promise is rejected if find() is called with insufficient permissions or if any of the previous functions used to refine the query are invalid.

Syntax

function find(): Promise<GuestsQueryResult>

find Parameters

This function does not take any parameters.

Returns

Return Type:

Was this helpful?

Run a query with no filters

Copy Code
1const query = guests.queryGuests.find();
2
Perform a find on a query

Copy Code
1import { guests } from 'wix-events.v2';
2
3export async function myQueryFunction() {
4 const results = await guests.queryGuests().find();
5
6 if (results.items.length > 0) {
7 const items = results.items;
8 const firstItem = items[0];
9 const pageSize = results.pageSize;
10 const hasNext = results.hasNext();
11 const hasPrev = results.hasPrev();
12 const length = results.length;
13 const query = results.query;
14
15 return items;
16 } else {
17 // Handle if no matching items found
18 }
19}
20