Creates a query to retrieve a list of category
objects.
The queryCategories()
function builds a query to retrieve a list of category
objects and returns a categoriesQueryBuilder
object.
The returned object contains the query definition, which is typically used to run the query using the find() function.
You can refine the query by chaining CategoriesQueryBuilder
functions onto the query. CategoriesQueryBuilder
functions enable you to sort, filter, and control the results that queryCategories()
returns.
queryCategories()
runs with the following CategoriesQueryBuilder
defaults that you can override:
limit
is 100
.createdDate
in ascending order.The functions that are chained to queryCategories()
are applied in the order they are called. For example, if you apply ascending("name")
and then ascending("id")
, the results are sorted first by name
, and then, if there are multiple results with the same name
, the items are sorted by id
.
The following CategoriesQueryBuilder
functions are supported for the queryCategories()
function. For a full description of the category
object, see the object returned for the items property in CategoriesQueryResult
.
PROPERTY | SUPPORTED FILTERS & SORTING |
---|---|
_id | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() ,gt() ,lt() ,le() ,ge() ,ascending() ,descending() |
name | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() ,gt() ,lt() ,le() ,ge() ,ascending() ,descending() |
sortOrder | eq() ,ne() ,exists() ,in() ,hasSome() ,lt() ,le() ,gt() ,ge() ,ascending() ,descending() |
This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.