The WixDataQuery
functions enable you to run, sort, filter, and control which results a query returns.
Typically, you build a query using the query()
function, refine the query by chaining WixDataQuery
functions, and then execute the query by chaining one of the following: find()
, distinct()
, or count()
.
For example, the following code queries a collection for all male customers over the age of 20 and logs the first 15 results to the console, sorted in ascending order by name:
When querying Wix app collections, make sure the fields you use to refine your query support the intended operations. Learn more about querying by Wix app collection fields.