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<ProductsQueryResult>
find Parameters
This function does not take any parameters.
Returns
Return Type:
Promise<>
Was this helpful?
Run a query with no filters
Copy Code
1const query = products.queryProducts.find();2
Perform a
find
on a queryCopy Code
1import { products } from 'wix-stores.v2';23export async function myQueryFunction() {4 const results = await products.queryProducts().find();56 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;1415 return items;16 } else {17 // Handle if no matching items found18 }19}20