find( )

Returns the items that match the query.

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 is invalid.

Calling the find() function triggers the beforeQuery() and afterQuery() hooks if they have been defined. If the query being run contains an include(), calling find() triggers beforeQuery() and afterQuery() hooks for the referenced collection as well.

Use the options parameter to override default preferences:

  • Override permission checks with suppressAuth.
  • Ensure the most up-to-date data is retrieved with consistentRead.
  • Prevent hooks from running with suppressHooks.
  • Speed up execution with omitTotalCount, if you don't need a count of items matching the query.

If you build a query and don't refine it with any wixDataQuery functions, find() returns the entire collection.

Method Declaration
Method Parameters

An object containing options to use when processing this operation.

Return Type:Promise<WixDataQueryResult>
Was this helpful?